faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 13 people (31%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I use input from one form to output to another form for processing & display??

Mar 6th, 2002 00:44
Nick R, Elaine Voon,


HELLO,
<html>
<head>
<title>the page that passes the string</title>
</head>
<body>
<?php
/*COMMENT: REPLACE $PHP_SELF WITH THE PAGE THAT YOU WANT TO PASS THE 
VALUE TO*/
echo '<form name="first_form" action="'.$PHP_SELF.'">
Enter your string:<br>
<input type="text" name="my_string" value="">
<input type="submit" value="submit">
</form>';
?>
</body></html>
<!------------------Your next page is as follows------------------------
-->
<html>
<?php 
//create the global variable $my_string or you may get a warning
global $my_string; 
?>
<head>
<title>the page that the form is on, receiving the string</title>
</head>
<body>
<form name="whatever" action="WHATEVER.php">
<!--echo the $my_string variable in the value=""(comes from previous 
page string------>
<input type="text" name="the_string" value="<?php echo $my_string; ?>">
<input type="submit" value="submit">
</form>
</body></html>