php - A form (action) error -
i have question, have page , form direct edit data database. need way use form , redirect action=editcinemas.php?cinema_id=the id of cinema
<html> <body> <form name="form3" method="post" action="editcinemas.php"> //my problem here guess <td> <table> <?php require('../classes/cinema_class.php'); $cinema=new cinema($_get["cinema_id"]); $cinemas = $cinema->get_all_cinemas(); foreach ($cinemas $movie) { $cinema_id = $movie['cinema_id']; $cinema_name = $movie['cinema_name']; $cinema_location = $movie['cinema_location']; } echo "<input name='cinemaid' type='hidden' id='cinemaid' value=" . $cinema_id . '><br/>'; echo "cinema name :"; echo "<input name='cinemaname' type='text' id='cinemaname' value=" . $cinema_name . '><br/>'; echo "cinema location :"; echo "<input name='cinemalocation' type='text' id='cinemalocation' value=" . $cinema_location . '><br/>'; ?> </table> <input type="submit" name="edit" value="edit"> <input type="reset" name="reset" value="reset"/><input type="button" value="back" onclick="history.go(-1);return true;"> </form> </body></html> <?php $cinemaid=$_post['cinemaid']; $cinemaname=$_post['cinemaname']; $cinemalocation=$_post['cinemalocation']; if ($_post) { if(empty($cinemaname)){ echo "cinema name must"; } else{ $update_movie=mysql_query("update `memoire`.`cinema` set `cinema_name`= '$cinemaname', `cinema_location`= '$cinemalocation' `cinema_id`='$cinemaid'"); if($update_movie) { header("refresh: 0;url=../listallcinemas.php");} else { echo "error in registration".mysql_error(); } } ?>
just append it, this:
<form name="form3" method="post" action="editcinemas.php?cinema_id=<?php echo $_get["cinema_id"]; ?>">
Comments
Post a Comment