使用下拉菜单获取数据时出现问题 [英] problem in fetching data using drop down

查看:95
本文介绍了使用下拉菜单获取数据时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?> ">
<input type="submit" name="submit" id="submit" value="submit" />
<?php

$con = mysql_connect("localhost","root","");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

mysql_select_db('import',$con) or die('could not select database') ;

$res=mysql_query("SELECT date FROM temp1 GROUP BY date HAVING COUNT(*)>1");
echo "<select name='select'>
<option value=''>--- Select ---</option> ";
while($row=mysql_fetch_assoc($res))
 {
echo "<option value=$row[date]>$row[date]</a></option>";
}
echo "</select>";
echo "</form>";
$result=mysql_query("SELECT id,date,mobno,state,type,telecaller FROM temp1 WHERE date='$select' ") or die(mysql_error());
"</form>";
echo"<table>";
echo"<tr> <th>id</th><th>date</th><th>mobno</th><th>state</th><th>type</th><th>telecaller</th>";
while($row=mysql_fetch_array($result))
{
    echo"<tr><td>";
    echo $row['id'];
     echo"<tr><td>";
    echo $row['date'];
     echo"<tr><td>";
    echo $row['mobno'];
     echo"<tr><td>";
    echo $row['state'];
     echo"<tr><td>";
    echo $row['type'];
     echo"<tr><td>";
    echo $row['telecaller'];
}
echo"</table>";
?>


单击提交按钮后出现以下错误..
禁止访问!

您无权访问所请求的对象.它是受读保护的或服务器不可读的.


I am getting the following error after clicking on submit button..
Access forbidden!

You don''t have permission to access the requested object. It is either read-protected or not readable by the server.

推荐答案

PHP_SELF; ?> " < 输入 =" 提交" 名称 提交" id =" 提交" 提交" / > <? php
PHP_SELF; ?> "> <input type="submit" name="submit" id="submit" value="submit" /> <?php


con mysql_connect(" localhost," root,"); 如果 (!
con = mysql_connect("localhost","root",""); if (!


con) { die('可以 不是 . mysql_error()); } mysql_select_db('import',
con) { die('Could not connect: ' . mysql_error()); } mysql_select_db('import',


这篇关于使用下拉菜单获取数据时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆