i have a html form it and some php script to post it to database but every time i open page it show some error on the top but when i input data and send it it also send so how can i remove these errors?
Errors:
Notice: Undefined index: fromcombo in C:\wamp\www\sit e\booking.php on line 8
Notice: Undefined index: tocombo in C:\wamp\www\sit e\booking.php on line 8
Notice: Undefined index: DV in C:\wamp\www\sit e\booking.php on line 8
php script:
Html Form:
Errors:
Notice: Undefined index: fromcombo in C:\wamp\www\sit e\booking.php on line 8
Notice: Undefined index: tocombo in C:\wamp\www\sit e\booking.php on line 8
Notice: Undefined index: DV in C:\wamp\www\sit e\booking.php on line 8
php script:
Code:
<?php
mysql_connect("localhost", "root", "password");
mysql_select_db("online_bus_project");
mysql_query("INSERT INTO trip (gender, country, date) VALUES ('$_POST[fromcombo]', '$_POST[tocombo]', '$_POST[DV]')");
?>
Html Form:
Code:
<form name="tstest" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<CENTER>From : <select name="fromcombo">
<option value="khairpur">Khairpur</option>
<option value="sukkur">Sukkur</option>
</select>
To : <select name="tocombo">
<option value="karachi">Karachi</option>
<option value="hyderabad">Hyderabad</option>
</select></CENTER><br /><br><br>
<CENTER>Date : <script type="text/javascript" language="javascript">
(INPUT(NAME("DV")+READONLY())+INPUT(TYPE("button")+VALUE("Calender")+ONCLICK("popCal(this.form.DV)"))).FORM().write();
</script></CENTER><br><br><br>
<center><input type="submit" value="Submit Info" /></CENTER>
</form>
Comment