Hello friends.

This is the first time I am trying this combination : Win XP prof + Mysql + Php + IIS.

When I click submit in the test1.php page, the page goes to test2.php, but shows the 
following error :

Notice: Undefined variable: StudentLastName in c:\inetpub\wwwroot\test\test2.php on 
line 12

Notice: Undefined variable: StudentFirstName in c:\inetpub\wwwroot\test\test2.php on 
line 12

Notice: Undefined variable: StudentTelNumber in c:\inetpub\wwwroot\test\test2.php on 
line 12
error adding row 

Can someone tell me what is wrong?  My code is shown below.

test1.php :
=========

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="test2.php">
  <table width="800" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td width="244" bgcolor="#FFFF99"><strong><font color="#000000" size="2" 
face="Arial, Helvetica, sans-serif">Last 
        name</font></strong></td>
      <td width="556"><input name="StudentLastName" type="text" 
id="StudentLastName"></td>
    </tr>
    <tr> 
      <td bgcolor="#FFFF99"><strong><font color="#000000" size="2" face="Arial, 
Helvetica, sans-serif">First 
        name</font></strong></td>
      <td><input name="StudentFirstName" type="text" id="StudentFirstName"></td>
    </tr>
    <tr> 
      <td bgcolor="#FFFF99"><strong><font color="#000000" size="2" face="Arial, 
Helvetica, sans-serif">Telephone 
        number</font></strong></td>
      <td> <input name="StudentTelNumber" type="text" id="StudentTelNumber"></td>
    </tr>
    <tr> 
      <td><font color="#FFFFCC">&nbsp;</font></td>
      <td><input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
</body>
</html>


test2.php :
========

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
$query="INSERT INTO tblstudents (StudentLastName,StudentFirstName,StudentTelNumber)    
    
VALUES ( '$StudentLastName','$StudentFirstName','$StudentTelNumber' ) ";
  
IF (mysql_query($query)){
  print "Congratulations ! Your data has been noted in the students database";
  } else {
  print "error adding row";
 }
 ?>
 
</body>
</html>

Reply via email to