RogueDogg1
Programmer
I have a variable that is passed via $_POST[FirstName] from apage2.php to it'self and now I do some edits to that page and submit that to apage3.php but the variable doesn't come across to the next page...how come?
Example:
db query to get firstname in a form then using the post method I submit that to the same page. Then add some features ( not changing the firstname variable at all ) and submit that form ( 2 total forms now ) using the post method as well. So we've got 2 forms with a total of 2 php files. I've tried using hidden values on the 1st php page to the 2nd php page but that doesn't work ( unless I'm doing it wrong ). Any Ideas?
Here is a simple live verison of it with the same issue:
I got rid of one php page but no matter it's still the same issue. So what you do is click on the first submit button and it now displays the website that was query'd from the database, now add some new text to the text box and click on the second submit button, you will notice only the text box variable is being passed to the 3rd page. Here is the code for the 2 pages:
test2.php
Here is the code for test3.php:
Hope that helps anyone understand my problem(s).
Example:
db query to get firstname in a form then using the post method I submit that to the same page. Then add some features ( not changing the firstname variable at all ) and submit that form ( 2 total forms now ) using the post method as well. So we've got 2 forms with a total of 2 php files. I've tried using hidden values on the 1st php page to the 2nd php page but that doesn't work ( unless I'm doing it wrong ). Any Ideas?
Here is a simple live verison of it with the same issue:
I got rid of one php page but no matter it's still the same issue. So what you do is click on the first submit button and it now displays the website that was query'd from the database, now add some new text to the text box and click on the second submit button, you will notice only the text box variable is being passed to the 3rd page. Here is the code for the 2 pages:
test2.php
Code:
<?
$db = mysql_connect ("localhost","dbuser","dbpword") or die(mysql_error());
$link = mysql_select_db ("cashflow_misc", $db) or die(mysql_error());
$query = "select website FROM websites";
$result = mysql_query($query);
$website = mysql_result ($result, 0);
?>
<form method="post" name="website" action="<? echo $_SERVER['PHP_SELF'];?>">
Database query complete press submit to see your website below:
<input type="hidden" name="website" value="<? echo "$website";?>" />
<input type="submit" name="add_website" value="submit" />
</form>
<br />
<br />
<form method="post" name="test" action="test3.php">
This is your website: <? echo $_POST['website'];?>
<br />
<br />
<input type="text" name="test" maxlength="18" value="blah test" />
<input type="submit" name="test2" value="submit" />
</form>
Here is the code for test3.php:
Code:
<?
echo "$website";?> this should be your website <br />
<? echo "$test";?>
Hope that helps anyone understand my problem(s).