Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Multi-Function Form Submit Button
Old 01-23-2008, 09:31 PM Multi-Function Form Submit Button
Junior Talker

Posts: 4
Name: Jacob Johnson
Trades: 0
I've been working on a form for a registration page that will accept PayPal, and I've a couple of questions...all of which will probably have obvious answers that I'm missing...

1) I need the submit to do one of two things. If the user selects the "Pay Now" option from a drop-down selection, it needs to act like the standard PayPal button (sending them to the PayPal website so they can make their payment). If they select the "Pay Later" option, it needs to NOT take them to PayPal and instead take them directly to the "Thank You" page.

2) I need the contents of the completed form to be sent to an e-mail address. This one I am pretty sure I can figure out, I'm just irritated with the Submit button right now. :evil:

Here's the code I'm working with:
Quote:
<form id="form1" name="form1" method="post" action="">
<p><span id="lastname">
<label>Last Name
<input type="text" name="lastname" id="lastname" />
</label>
</span></p>
<p><span id="firstname">
<label>First Name
<input type="text" name="firstname" id="firstname" />
</label>
</span></p>
<p><span id="address">
<label>Street Address
<input type="text" name="address" id="address" />
</label>
</span></p>
<p><span id="city">
<label>City
<input type="text" name="city" id="city" />
</label>
</span></p>
<p><span id="state">
<label>State
<input type="text" name="state" id="state" />
</label>
</span></p>
<p><span id="zip">
<label>Zip Code
<input type="text" name="zip" id="zip" />
</label>
</span></p>
<p><span id="phone">
<label>Phone Number
<input type="text" name="phone" id="phone" />
</label>
</span></p>
<p>
<label>E-Mail Address
<input name="email" type="text" id="email" />
</label>
</p>
<p>
<label>Web Site
<input type="text" name="website" id="website" />
</label>
</p>
<p><span id="team">
<label>Prefered Team
<select name="team" id="team">
<option selected="selected">USA Special Forces</option>
<option>Columbian Government</option>
<option>Columbian Drug Cartel</option>
<option>I just want to shoot someone!</option>
</select>
</label>
</span></p>
<p><span id="payment">
<label>Payment Options
<select name="payment" id="payment">
<option selected="selected">Pay now via Paypal - $25.00</option>
<option>Pay at the field - $35.00</option>
</select>
</label>
</span></p>
<p>
<label>Comments, Special Equipment, or Special Needs<br />
<br />
<textarea name="comments" id="comments" cols="70" rows="5"></textarea>
</label>
</p>
<p><input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="bn" value="webassist.dreamweaver.4_5_0" />
[removed paypal account identifying parameters. Lets NOT make it easy for the crackers and scammers]
<input type="image" name="submit" src="http://www.wolfcreekpaintball.com/images/button_submit.gif" border="0" alt="Make payments with PayPal, it's fast, free, and secure!" />
</p>
</form>

Last edited by chrishirst; 01-24-2008 at 03:41 AM..
brokenshadows is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-24-2008, 03:39 AM Re: Multi-Function Form Submit Button
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And the server side code would be ?
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2008, 06:30 AM Re: Multi-Function Form Submit Button
Junior Talker

Posts: 4
Name: Jacob Johnson
Trades: 0
sorry...I knew I was forgetting something

i'm using js...too little sleep...i forgot that there needs to be some code to tell the form what to do
brokenshadows is offline
Reply With Quote
View Public Profile
 
Old 01-24-2008, 03:34 PM Re: Multi-Function Form Submit Button
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
set the form action attribute to go to paypal and add two radio buttons to the form called "frm_action"
HTML Code:
<input type="radio" name="frm_action" value="0" checked="checked" onclick="frmAction(0)">Pay Now
<input type="radio" name="frm_action" value="1" onclick="frmAction(1)">Pay Later
Code:
<script type="text/javascript">
function frmAction(which) {
     if (which == 1) {
          document.formname.action = "URL_to_ServerSide_Script.ext"
      } else {
          document.formname.action = "URL_to_PayPal"
       }
}
</script>
on the "thank you page" is where you send the email.

Catch the return value from PayPal and if it exists then the transaction is complete or denied, if it ain't there and the post key frmaction = 1 then it's a pay later.

not tested the above code but it looks ok.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-24-2008, 06:23 PM Re: Multi-Function Form Submit Button
Junior Talker

Posts: 4
Name: Jacob Johnson
Trades: 0
thanks...I'll try that
brokenshadows is offline
Reply With Quote
View Public Profile
 
Old 01-25-2008, 07:52 PM Re: Multi-Function Form Submit Button
Junior Talker

Posts: 4
Name: Jacob Johnson
Trades: 0
ok...this is going to sound like another stupid question, I'm sure...

how would I make this work with php? I've never used php before and the form builder I decided to use (because I'm in a bit of a time crunch) built the form in php...

thanks for your patience

edit: I've attached a zip file of the php and htm files that I'm using. The form ends up sending a confirmation e-mail to the user, and e-mail to the business, and then sends the user to a thank you page. I've never worked with PHP before, so I have no idea where to put whatever it is I need to put to make it send the user to PayPal if they select the appropriate radio button.

Last edited by brokenshadows; 01-27-2008 at 06:02 PM.. Reason: attaching zip of working files
brokenshadows is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Multi-Function Form Submit Button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.74013 seconds with 12 queries