passing post in htm as variable into another form
Posted: Sat Feb 26, 2011 2:06 pm
I have an hml page that uses option values and lets the user select values. the values are php pages which when they submit pass the chosen value to the next page I show a snip below. I wanted to have the form action grab the formVar passed to it- but I can't seem to get it going. I figure I just may not be putting the post in correctly- any help appreciated
I have two pages page1 and page 2 page 1 does the following. since I have a page i want to call (page2_test_html) with all 3 options
I want page2 to be passed the option value(another page) so when a user fills out page2 they will hit submit and get to the page.
page1 is as follows:
<html>
<select onchange="document.myform.formVar.value=this.value">
<option value="newtest.php">poe</option>
<option value="newtest1.php">non poe</option>
<option value="newtest2.php">non poe 24/option>
</select>
<form method=post name="myform" action="page2_test.html">
<input type="hidden" name="formVar" value="">
<input type="submit" value="Send form!">
</form>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
page 2 part that im having issues w/ as follows:
<head><title>page2</title></head>
<body>
<form action="<?php $_POST['formVar']; ?>" method="POST">
which doesnt work- I've also tried to pass it to this in these ways as someone else suggesting giving it a try but still doesnt work
tried this way
<form action="<?php echo{$_POST['formVar']}; ?>" method="POST">
and this way w/ no luck
<form action="<?php echo($_POST['formVar']); ?>" method="POST">
any help is greatly greatly appreciated
I have two pages page1 and page 2 page 1 does the following. since I have a page i want to call (page2_test_html) with all 3 options
I want page2 to be passed the option value(another page) so when a user fills out page2 they will hit submit and get to the page.
page1 is as follows:
<html>
<select onchange="document.myform.formVar.value=this.value">
<option value="newtest.php">poe</option>
<option value="newtest1.php">non poe</option>
<option value="newtest2.php">non poe 24/option>
</select>
<form method=post name="myform" action="page2_test.html">
<input type="hidden" name="formVar" value="">
<input type="submit" value="Send form!">
</form>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
page 2 part that im having issues w/ as follows:
<head><title>page2</title></head>
<body>
<form action="<?php $_POST['formVar']; ?>" method="POST">
which doesnt work- I've also tried to pass it to this in these ways as someone else suggesting giving it a try but still doesnt work
tried this way
<form action="<?php echo{$_POST['formVar']}; ?>" method="POST">
and this way w/ no luck
<form action="<?php echo($_POST['formVar']); ?>" method="POST">
any help is greatly greatly appreciated