0

質問があります。データをデータベースに編集するためにそれ自体に指示するページとフォームがあります。フォームを使用して action=editcinemas.php?cinema_id=THE ID OF CINEMA でリダイレクトする方法が必要です

 <html>
<body>
<form name="form3" method="post" action="editcinemas.php"> //MY PROBLEM IS HERE I GUESS
    <td>
        <table>
        <?php
require('../classes/cinema_class.php');
$cinema=new cinema($_GET["cinema_id"]);

$cinemas = $cinema->get_all_cinemas();

foreach ($cinemas as $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 is a must"; }
else{
$update_movie=mysql_query("UPDATE `memoire`.`cinema` 
                        SET `cinema_name`= '$cinemaname', `cinema_location`= '$cinemalocation' 
                        WHERE `cinema_id`='$cinemaid'");
if($update_movie)
{ header("Refresh: 0;url=../listallcinemas.php");}
else
{ echo "error in registration".mysql_error(); }

}
?>
4

1 に答える 1