| | |
JS variable in PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
You have to submit the form to a server side script then you can pull the fields in using the $_POST or $_GET superglobals.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Sep 2007
Posts: 54
Reputation:
Solved Threads: 2
If those fields have the same NAME, ie.
<input type="text" name="user_input">
<input type="text" name="user_input">
<input type="text" name="user_input">
<input type="text" name="user_input">
When the form that encloses these input's is submitted then the PHP variable on the server would be:
$_GET['user_input']
or
$_POST['user_input']
depending on your method get or post.
It will be an array containing the values of all form elements with the name 'user_input' that belongs to the form that was submitted.
In the PHP file that the form is submitted to try this:
var_export($_GET['user_input'])
or $_POST, whichever you are using and it will dump the structure of array where you should see the values that you had entered into the forms before submission.
This will give you a clear idea of how to retrieve the individual values from that array.
<input type="text" name="user_input">
<input type="text" name="user_input">
<input type="text" name="user_input">
<input type="text" name="user_input">
When the form that encloses these input's is submitted then the PHP variable on the server would be:
$_GET['user_input']
or
$_POST['user_input']
depending on your method get or post.
It will be an array containing the values of all form elements with the name 'user_input' that belongs to the form that was submitted.
In the PHP file that the form is submitted to try this:
var_export($_GET['user_input'])
or $_POST, whichever you are using and it will dump the structure of array where you should see the values that you had entered into the forms before submission.
This will give you a clear idea of how to retrieve the individual values from that array.
![]() |
Similar Threads
- PHP URL variables and if statement (PHP)
- how to assign javascript variable to php variable (PHP)
- Move Javascript Variable to PHP (JavaScript / DHTML / AJAX)
- Pass a javascript variable to PHP in the same function (JavaScript / DHTML / AJAX)
- Passing a Javascript variable to a PHP using <script> call (JavaScript / DHTML / AJAX)
- PHP Includes + (PHP)
- $variable inside quotes (PHP)
- How Can I Pass A PHP Variable From One .php page to another (PHP)
Other Threads in the PHP Forum
- Previous Thread: Bots as users + PTC Site
- Next Thread: about CakePHP Development
| Thread Tools | Search this Thread |
.htaccess ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google headmethod href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu mlm mod_rewrite multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validation validator variable video web xml youtube





