Refuring to values iin another page.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
OCCollins
Forum Newbie
Posts: 2
Joined: Mon Jun 19, 2006 8:13 am

Refuring to values iin another page.

Post 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.
Last edited by OCCollins on Mon Jun 19, 2006 9:55 am, edited 1 time in total.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
OCCollins
Forum Newbie
Posts: 2
Joined: Mon Jun 19, 2006 8:13 am

Post 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.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post 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
Post Reply