Introduction to the mutual value of JS and PHP _php tutorial

Source: Internet
Author: User
JS is the language of the front desk, PHP is the background of the language, beginners will often appear before and after the Taiwan Division of the situation (I was so, and now sometimes committed), my original idea is to put the front and back as two islands, they can not cross, HTML is like a bridge, When you want to spread a variable on an island to another island, only with the help of this bridge.
Let me make a small summary:
How to upload the value of 1:html to JS, the following assumption is file 1.php
Copy CodeThe code is as follows:






JS If you want to take the text box user input name value, so write
Copy CodeThe code is as follows:


In this case, a call to JS get () will pop up the warning box, the content is the name of the value.
2: If the JS in the name of the value to be passed back to the Rename text box, so write
Copy CodeThe code is as follows:


In this case, calling get () below will automatically display the value you entered on the name above.
3:php The value of the page
I think everybody's going to do it.
Copy CodeThe code is as follows:
$name =$_request["username"];
Echo $name;
?>

4:php value returned to page
Insert the PHP language in HTML, you can call the value of the variables in PHP, also available smarty (recommended).
With these, both the value of the HTML page or the value of the variable in JS can be easily passed to PHP, of course, the value of PHP can also be uploaded to the desired place.

http://www.bkjia.com/PHPjc/327851.html www.bkjia.com true http://www.bkjia.com/PHPjc/327851.html techarticle JS is the language of the front desk, PHP is the background of the language, beginners will often appear before and after the platform of the situation (I was so, and now sometimes committed), I was the original idea is to put the former ...

  • 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.