Insert Working;but want to make sure all fields contain data
Posted: Wed Mar 31, 2004 9:34 am
Here is my code as heading describes want all fields in the form to hold data before it can be summitted...sorry for all the questions around the same topic....Thanks!
_____________
<html>
<head><title>Flight Details</title></head>
<body text="blue" bgcolor="FFFFCC">
<HR SIZE=4 style="background-color: blue">
<body>
<h1 align="center" h1><b><FONT COLOR="blue">FIND THE RIGHT TIME TO FLY!!<br>Flight Details</b></font></h1>
<center><img src="http://images.google.com/images?q=tbn:P ... r"</center>
<HR SIZE=4 style="background-color: blue">
<h2><center>Flights</h2>
<form method="post"action="<?php echo $PHP_SELF?>">
<table cellpadding=2 cellspacing=0 border=1>
<td>Flight Id :</td><td> <input type="text" size="10" maxlength="4" name="flightid" value=""></td><tr>
<td>Fly Day:</td><td><input type="text" size="20" maxlength="10" name="flyday" value=""></td></tr>
<td>Time:</td><td> <input type="decimal" size="10" name="time"value=" "></td></tr>
<td>Destination From</td><td> <input type="text" size="20" maxlength="15" name="destinationfrom" value=""></td></tr>
<td>Destination Till</td><td> <input type="text" size="20" maxlength="15" name="destinationtill" value=""> </td><tr>
</table>
<input type="Submit" name="flights" value="Enter Flight Details">
<HR SIZE=4 style="background-color: blue">
</form>
</body>
</html>
_____________
<html>
<head><title>Flight Details</title></head>
<body text="blue" bgcolor="FFFFCC">
<HR SIZE=4 style="background-color: blue">
<body>
<h1 align="center" h1><b><FONT COLOR="blue">FIND THE RIGHT TIME TO FLY!!<br>Flight Details</b></font></h1>
<center><img src="http://images.google.com/images?q=tbn:P ... r"</center>
<HR SIZE=4 style="background-color: blue">
<h2><center>Flights</h2>
Code: Select all
<?
$db = "u2ell";
$host = "mysql";
$user = "u2ell";
$pass = "";
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die (mysql_error());
//the connection to the database was successful
$flightid=$HTTP_POST_VARS['flightid'];
$flyday=$HTTP_POST_VARS['flyday'];
$time=$HTTP_POST_VARS['time'];
$destinationfrom=$HTTP_POST_VARS['destinationfrom'];
$destinationtill=$HTTP_POST_VARS['destinationtill'];
$query = "INSERT INTO flights(flightid,flyday,time,destinationfrom,destinationtill)
VALUES('$flightid','$flyday','$time','$destinationfrom','$destinationtill')";
$result = mysql_query($query) or die ("Execution failed.");
?><table cellpadding=2 cellspacing=0 border=1>
<td>Flight Id :</td><td> <input type="text" size="10" maxlength="4" name="flightid" value=""></td><tr>
<td>Fly Day:</td><td><input type="text" size="20" maxlength="10" name="flyday" value=""></td></tr>
<td>Time:</td><td> <input type="decimal" size="10" name="time"value=" "></td></tr>
<td>Destination From</td><td> <input type="text" size="20" maxlength="15" name="destinationfrom" value=""></td></tr>
<td>Destination Till</td><td> <input type="text" size="20" maxlength="15" name="destinationtill" value=""> </td><tr>
</table>
<input type="Submit" name="flights" value="Enter Flight Details">
<HR SIZE=4 style="background-color: blue">
</form>
</body>
</html>