首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >表单(操作)错误

表单(操作)错误
EN

Stack Overflow用户
提问于 2013-05-04 22:52:00
回答 1查看 125关注 0票数 0

我有一个问题,我有一个页面和一个表单,我直接它到自己编辑数据到数据库。我需要一种方式来使用表单,并与影院的action=editcinemas.php?cinema_id=THE ID重定向自己

代码语言:javascript
复制
 <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(); }

}
?>
EN

回答 1

Stack Overflow用户

发布于 2013-05-04 22:56:06

只需简单地附加它,就像这样:

代码语言:javascript
复制
<form name="form3" method="post" action="editcinemas.php?cinema_id=<?php echo $_GET["cinema_id"]; ?>">
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16375560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档