0

hi all -

php.home
Im trying to pass a varible of "MOBILE" from a form i have set up

<td><span class="style61">Mobile number</span></td>
<td><span class="style61">
<label for="mobile"></label>
<input type="text" name="mobile" id="mobile" />

To a differnet .php called test.php

On this test php i have the following $mobile = $HTTP_POST_VARS['$mobile']; how do I pass the mobile number from the form on home.php to the above variable on test.php
Hope someone can help me on this...

many thanks in advance

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by DaveyMoyes
0

Html form tag and action attribute:

Add following code into home.php

<form method="post" action="test.php">
     Mobile <input type="text" name="mobile"/>
                <input type="submit" value="Submit"/>
   </form>

and test.php

<?php
   $mobile=$_POST["mobile"];
   ...
?>

Your source code must be surrounded by bb code tags. Read - How to use BB code tags.

0

Edit: Sorry but I was typing this when adatapost beat me to the answer by seconds.
Simply use action="test.php" in the <form> tag. Below is an example:

<form method="post" action="test.php">
<input type="text" name="mobile" id="mobile" />
<input type="submit" value="send"></form>

Then in test.php, to display the value use the following

$mobile=$_POST['mobile']; //retrieves it
echo $mobile; //displays it

Although you may want to modify the form a bit to suit your needs, the above is the basic code.

0

Gents thanks very much for your help on this....
At times i feel daft asking some questions to you seasonal professionals, but im new to php and find it amazing..

many many thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.