doushenken2833 2014-09-12 09:29 采纳率: 0%
浏览 82
已采纳

为什么提交按钮失败并打开没有地址的空白页?

I am developing a small php page.

When I click a submit button no takes any action, just forwards me to a blank page. Why does this happen?

Will can help me please?

Thank you all very much.

    <?php
if(isset($_POST['update']))
{
$dbhost = '****';
$dbuser = '****';
$dbpass = '****';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql\_error());
}

$task = $_POST['task'];

$sql = "UPDATE tasks set idTask = '$task' , date = curdate(), hour = curtime(), status = '3' WHERE idTask = '$task'" ;

mysql_select_db('db_Tasks');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not update data: ' . mysql_error());
}
echo "Task $task started 
";
mysql_close($conn);
}

    <form method="post"  action="<?php $_PHP_SELF ?> ">
<table width="285px" border="0" cellspacing="1" cellpadding="2" style="background-color:#A4A4A4;">
<tr>
<td width="100">Task</td>
<td><input name="tarefa" type="text" id="tarefa"></td>
</tr>
<td>
<input name="update" type="submit" id="update" value="Start">

enter image description here

When I click a submit button no takes any action, just forwards me to a blank page. Why does this happen?

enter image description here

  • 写回答

4条回答 默认 最新

  • doucu5836 2014-09-12 09:34
    关注

    change $_PHP_SELF to this $_SERVER['PHP_SELF'];

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?