PHP has two methods “post” and “get” to pass data to another page.
Example – 1
Send data to one to another page using POST
HTML PAGE
OUTPUT
Your start.php page for display data looks like this.
start.php
When a user clicks on submit button, data is posted on start.php with the HTTP POST method.
Output
Welcome Peter
Your email address is peter@example.com
Example – 2
Send data to one to another page using GET
Your start_get.php page for display data look like this.
start_get.php
When a user clicks on submit button data is posted on start_get.php with the HTTP GET method.
So both POST and GET method send data to another page but main question is when we use GET and POST method ?
Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send. The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.
GET may be used for sending non-sensitive data.
Note: GET should NEVER be used for sending passwords or other sensitive information!
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.
Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.
However, because the variables are not displayed in the URL, it is not possible to bookmark the page.
Developers prefer POST for sending form data.
First , we created two js (javascript) files
a. first.js
b. second.js
A variable in global scope can be access from all javascript file.
Your first.js file
And your second.js file
And in html page add-
Instead of using the .css file extension, use .php
HTML
At the top of your new style.php file set the Content-type back to CSS:
PHP
Now you can set up variables for whatever you like:
Below all that PHP stuff, you can just commence regular CSS writing, only you can intermix some PHP to spit out those variables.
Related Post: How To Minify CSS And JavaScript Of Your WordPress Website
CSS
Leave a Reply