Post based on a variable?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

NYColt
New php-forum User
New php-forum User
Posts: 34
Joined: Fri Feb 14, 2003 2:33 am
Location: New York

Post based on a variable?

Postby NYColt » Fri Feb 14, 2003 2:43 am

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.

NYColt

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Postby pootergeist » Fri Feb 14, 2003 6:13 am

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.

NYColt
New php-forum User
New php-forum User
Posts: 34
Joined: Fri Feb 14, 2003 2:33 am
Location: New York

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

Postby NYColt » Fri Feb 14, 2003 1:52 pm

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="http://auth.paysystems.com/sale.asp?$length" method=post>

<?php
$a="pd_info=6036866441078262BAAEBFF88D2B6C8F6FAA187CC94651CF6FAEEDE81E1538AF/";
$b="pd_info=2A43F8ADFB949F5B6483F84DF24831F6A6E899FF6115CC998938DF5E4C73646F/";
$c="pd_info=7BEB91582B70C17367B6878252B05A1751913A6CD310B3EF002AD45D63CE9759/";
?>


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

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

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

<a href="http://auth.paysystems.com/sale.asp?pd_info=6036866441078262BAAEBFF88D2B6C8F6FAA187CC94651CF6FAEEDE81E1538AF/"> Send Once</a>

<a href="http://auth.paysystems.com/sale.asp?pd_info=2A43F8ADFB949F5B6483F84DF24831F6A6E899FF6115CC998938DF5E4C73646F/"> Every Two Weeks</a>

<a href="http://auth.paysystems.com/sale.asp?pd_info=7BEB91582B70C17367B6878252B05A1751913A6CD310B3EF002AD45D63CE9759/"> 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!!

NYColt

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Fri Feb 14, 2003 3:14 pm

Code: Select all

<form action="http://auth.paysystems.com/sale.asp" method="get">

<?php
$a="6036866441078262BAAEBFF88D2B6C8F6FAA187CC94651CF6FAEEDE81E1538AF/";
$b="2A43F8ADFB949F5B6483F84DF24831F6A6E899FF6115CC998938DF5E4C73646F/";
$c="7BEB91582B70C17367B6878252B05A1751913A6CD310B3EF002AD45D63CE9759/";
?>


<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>
</select>

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



THat should work for ya.

NYColt
New php-forum User
New php-forum User
Posts: 34
Joined: Fri Feb 14, 2003 2:33 am
Location: New York

Thats Perfect!

Postby NYColt » Sat Feb 15, 2003 5:22 am

Thanks Redcircle!

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

NYColt


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 5 guests