dongyuedaochen8415 2012-06-22 15:53
浏览 20
已采纳

isset提交无效

I am using isset function to check if the submit button is clicked, but it's not working. It is not entering into the if. here is my code. I am not getting where the problem persists.

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><h2><br />
            User Registration</h2>
            <p>&nbsp;</p></td>
    </tr>
    <tr>
        <td>
            <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1" id="form1" onsubmit="return Validate();">
                User Name[E-mail ID]: <input type="text" name="username" style="width:230px; height:20px;" /><br /><br />
                Password : <input type="password" name="password" style="width:230px; height:20px;" /><br /><br />
                Name <input type="text" name="name" style="width:230px; height:20px;" /><br /><br />
                Contact Number: <input type="text" name="phone" style="width:230px; height:20px;" /><br /><br />
                Email: <input type="text" name="email" style="width:230px; height:20px;" /><br /><br />
                <input type="submit" value="REGISTER" />
            </form>

            <?php
            include('connect.php');
            if (isset($_POST['submit']))
            {
                echo "1";
                $username = $_POST['username'];
                echo $username;

                $password = $_POST['password'];
                $name = $_POST['name'];
                $phone = $_POST['phone'];   

                $email = $_POST['email'];
                //$id = $_GET['aid'];

                $sql = "INSERT INTO user_info(application_id, username, password, name, contact, email) VALUES (" . $aid. ", " .$username.", ".$password.", ".$name.",". $phone.", ".$email.") ";
                echo $sql;
                mysql_query($sql) or die(mysql_error());
                //header("Location: index1.php");
            }

            ?>

        </td>
    </tr>
    <tr>
        <td>&nbsp;</td>
    </tr>
</table>

Please let me know where I am going wrong.

  • 写回答

4条回答 默认 最新

  • douyalin2258 2012-06-22 15:55
    关注

    Change

    <input type="submit" value="REGISTER" />
    

    to

    <input type="submit" name="submit" value="REGISTER" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法