duanpu6319 2009-07-29 10:30
浏览 34
已采纳

回复从PHP到javascript的响应

I'm new to forms and post data ... so I don't know how solve this problem!

I've a php page (page1) with a simple form:

<form method="post" action="/page2.php">
<input type="search" value="E-Mail Address" size="30" name="email" />
<input type="submit" value="Find E-Mail" />
</form>

How you can notice ... this form post the 'email' value to the page2. In the page2 there is a small script that lookup in a database to check if the email address exist.

$email = $_POST['email'];

$resut = mysql_query("SELECT * FROM table WHERE email = $email");
.   
.
.
/* do something */
.
.
.

if($result){
    //post back yes
}
else{
   //post back no
}

I don't know how make the post back in php! And how can I do to the post back data are read from a javascript method that shows an alert reporting the result of the search?

This is only an example of what I'm trying to do, because my page2 make some other actions before the post back.

When I click on the submit button, I'm trying to animate a spinning indicator ... this is the reason that I need to post back to a javascript method! Because the javascript function should stop the animation and pop up the alert with the result of the search!

Very thanks in advance!

  • 写回答

5条回答 默认 最新

  • dougong2306 2009-07-29 10:35
    关注

    I suggest you read up on AJAX.

    Here's a PHP example on W3Schools that details an AJAX hit.

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器