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

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.

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.

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.