I have 2 table: 1 name is movie and another's name is screen. movie table contains fields like movie_id,movie_name etc. screen table contains fields like movie_id screen_id etc. I am going to add data in my screen table by user.
So i want that if user enter the movie_id which is not in movie table then it should prompt the user and display msg as plz enter correct movie_id. my code is as: plz verify this and answer me as soon as possible. plz
<?php require_once '.../dbconfig.php/';
//echo hi;
if(isset($_POST['submit']))
{
$sql=mysql_query("INSERT INTO screen(`movie_id`,`screen_id`,`theatre_id`,`capacity`)
VALUES('$_POST[t1]','$_POST[t2]','$_POST[t3]','$_POST[t4]')");
echo $sql." Record added Successfully";
}
?>
<html>
<form action="" method="post" name="add_screen" id="movie" onSubmit="return validation();">
<div>
<fieldset>
<table width="100%" cellpadding="5" cellspacing="5" align="center">
<tr>
<th colspan="2" valign="top" align="left" style="padding-left:263px;"><span style="border-bottom:#000000 2px solid;"></span></th>
</tr>
<tr><td>Enter Movie_Id</td><td><input type="text" name="t1" value="" size="20" /><br></td></tr>
<tr><td>Enter Screen_Id</td><td><input type="text" name="t2" value="" size="20" /></td></tr>
<tr><td>Enter Theatre_Id</td><td><input type="text" name="t3" value="" size="20" /></td></tr>
<tr><td>Enter capacity of Theatre</td><td><input type="text" name="t4" value="" size="20" /></td></tr>
<tr><td> <center><input type="submit" value="Submit" name="submit" /></center></td></tr>
</table>
</fieldset>
</form>
</html>