hi all -

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

Re: Passing Variables 80 80

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"/>

and test.php


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

Re: Passing Variables 80 80

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.

Re: Passing Variables 80 80

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.