Page 1 of 1

Post based on a variable?

Posted: Fri Feb 14, 2003 2:43 am
by NYColt
Hi All

I am new to your forum and new to PHP, so far both are outstanding.

My question is this:

B4 I get too far into creating my variables ( I warned you, I'm new to this :)) I wanted to know, Is it possible to post a form to an address based on the result of a variable?

If the answer to this is yes, shortly I will post an example of what I am trying to do.

Any insight would be great.
And thank you for allowing me to be part of your forum.


Posted: Fri Feb 14, 2003 6:13 am
by pootergeist
yes - either through echoing the var within the action parameter of the form tag or through javascripting a value to the document.forms[n].action variable.

Here is a "sample" of what I want to do

Posted: Fri Feb 14, 2003 1:52 pm
by NYColt
Hello pootergeist,

Thanks for the look see,

Here is what I want to do.
I know that it is all wrong (because it doesnt work) butI think it will give you an idea as to where I am going with this.

I just don't know enough php to get it right. As you can tell I am on page 20 of "The Book of PHP"

<form action="$length" method=post>


<select name="$length">
<option value = "$a">Send Once
<option value = "$b">Every Two Weeks
<option value = "$c">Once A Month

<input type=submit value="Submit Order">

These are the working links that I want to put to work in a drop box list:

<a href=""> Send Once</a>

<a href=""> Every Two Weeks</a>

<a href=""> Once A Month</a>

Hopefully I know just enough PHP to get my point accross to you.

can this be done?

Any help would be AWESOME!!


Posted: Fri Feb 14, 2003 3:14 pm
by Redcircle

Code: Select all

<form action="" method="get"> 


<select name="pd_info">
<option value = "<?php echo $a; ?>">Send Once </option>
<option value = "<?php echo $b; ?>">Every Two Weeks </option>
<option value = "<?php echo $c; ?>">Once A Month </option>

<input type=submit name="submit" value="Submit Order">

THat should work for ya.

Thats Perfect!

Posted: Sat Feb 15, 2003 5:22 am
by NYColt
Thanks Redcircle!

I really appreciate it. That is exactly what I need!
Thanks Again.