Page 1 of 1
Refuring to values iin another page.
Posted: Mon Jun 19, 2006 8:26 am
by OCCollins
I have a form with some input boxes in it but was wonderiing what the php code is that allows another page refers to the value that is put into the input box and then writes it out in the the same kind of was as document.writeln does in JavaScript.
Posted: Mon Jun 19, 2006 9:44 am
by Ambush Commander
You'd have to have this page make some adjustments. What it would do is take $_GET parameters passed to it and write it to the input box.
Posted: Mon Jun 19, 2006 11:54 am
by OCCollins
I have a form with some input boxes in it but was wonderiing what the php code is that allows another page refers to the value that is put into the input box and then writes it out in the the same kind of was as document.writeln does in JavaScript.
Posted: Mon Jun 19, 2006 12:44 pm
by Benjamin
If your form is like...
Code: Select all
<form name="blah" action="test.php" method="post">
<input type="text" name="TheVariableName" value="" />
<input type="submit" value="Click Me" />
</form>
Then in test.php you would put...
Code: Select all
<?php
// I am going to echo what you posted...
if ((isset($_POST['TheVariableName'])) and (trim($_POST['TheVariableName']) != '')) {
echo "You posted " . $_POST['TheVariableName'];
} else {
echo "No data received";
}
?>
If your action is get then change all of the $_POST to $_GET