Undefined Index error

Undefined error in php insert query
Am attaching the code file here


<?php
include_once('connect.php');
?>
<?php
$bno=$_POST['bno'];
$cun=$_POST['cun'];
$pswd=$_POST['pswd'];
$sql="INSERT INTO tbl_addbar (barnum, cusname, pwd) VALUES ('$bno','$cun','$pswd')";
if(!mysql_query($sql))
{
    die('Error:'.mysql_error());
    
}
mysql_close($con)
?>



Html form 

<form id="form1" name="form1" method="post" action="">
      <table width="342" border="1">
        <tr>
          <td width="154">Barcode Number</td>
          <td width="172"><input type="text" name="bno" id="bno" /></td>
        </tr>
        <tr>
          <td>Customer Name </td>
          <td><input type="text" name="cun" id="cun" /></td>
        </tr>
        <tr>
          <td>Password</td>
          <td><input type="password" name="pswd" id="pswd" /></td>
        </tr>
        <tr>
          <td colspan="2"><div align="center">
            <input type="submit" name="btnsave" id="btnsave" value="Save" />
          </div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <br /><br />

    </form>

use isset to identify if a variable is set and is not NULL


$bno=isset($_POST['bno']) ? $_POST['bno'] : '';
$cun=isset($_POST['cun']) ? $_POST['cun'] : '';;
$pswd=isset($_POST['pswd']) ? $_POST['pswd'] : '';;


How to set isset …can u show one example

^ he did!

pkay thanks gr8 .Now its working