How to simulate the click button in PHP

Source: Internet
Author: User
This article focuses on how to simulate the Click submit button in PHP. Let's take a concrete example to illustrate this.

A snippet of code is as follows:

<?php   session_start ();     Require ("config.php");     $db = mysql_connect ($dbhost, $dbuser, $dbpassword);   mysql_select_db ($dbdatabase, $db);     if ($_post[' Submit ']!= ") {   $username =$_session[username];   $city =$_post[city];   $attraction =$_post[attraction];   $imageNum =$_post[number];   $relevance =$_post[relevance];   $sql = "Insert into vote (username,city,attraction,imagenum,relevance,dateposted) Values (' $username ', ' $city ', ' $ Attraction ', ' $imageNum ', ' $relevance ', Now ()) ";  $result =mysql_query ($sql);   echo "";   echo "";   }   ? >

If we are based on the above code, want to achieve the success of each evaluation after the automatic jump to the next image of the function is simulated click "AddButton" (AddButton function is to skip to the next image)

How can this function be implemented? The solution is as follows two points:

1, pop-up prompt box, and then automatically jump to the specified page, that is, redirect:

function Alertinfor ($infor = False, $href = False) {echo <<script;} Alertinfor ("Evaluation Success", "next.html");

2, pop up the Prompt box, and then execute the JS script to replace the picture: Replace the contents of your AddButton function with the next sentence of the alert. However, this code must be on the same page as your page JS.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.