Current location: Hot Scripts Forums » Programming Languages » PHP » Multi-Part/Step Email Form??? How to ??


Multi-Part/Step Email Form??? How to ??

Reply
  #1 (permalink)  
Old 02-11-09, 01:58 PM
davestar057 davestar057 is offline
Wannabe Coder
 
Join Date: Dec 2007
Posts: 115
Thanks: 1
Thanked 1 Time in 1 Post
Multi-Part/Step Email Form??? How to ??

Hi Guys,

Okay, I need your fine help.

Okay, so I can do the whole submit a form and send it to email etc...

the problem I have, that I cannot figure out is how to do a "multi step" form??

For example

STEP 1 (YOUR DETAILS)
name
email
age
location


STEP TWO (SETUP ACCOUN DETAILS)

username
password
reminder

STEP THREE (PETS DETAILS

cats name
cats age

etc....

STEP FOUR - DONE - SENDS EMAIL


So like I said I can do all the mechanics of a php form to email address, thats simple...just wondering how I would do the multi part/step form that then sends the info to an email address.

Hope that makes sense.

You guys rock, please help me out

THANK YOU
David
Reply With Quote
  #2 (permalink)  
Old 02-11-09, 03:12 PM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 334
Thanks: 2
Thanked 8 Times in 8 Posts
You have a couple options... if it's nothing too large scale, you could do hidden form elements.

on your 2nd page, you could have it like so:

HTML Code:
<form action="3rd_page.php" method="post" name="form" id="form">
<input type="text" name="username" id="username" size="32" />
<input type="password" name="passwd" id="passwd" size="32" />
<input type="text" name="reminder" id="reminder" size="32" />

<!-- begin data carryover from 1st form page -->
<input type="hidden" value="<?php echo $_POST['name']; ?>" />
<input type="hidden" value="<?php echo $_POST['email']; ?>" />
<input type="hidden" value="<?php echo $_POST['age']; ?>" />
<input type="hidden" value="<?php echo $_POST['location']; ?>" />

<input type="submit" value="submit" />
Obviously the HTML styling is missing from the above, but you get the point When the user submits this page, the new information is submitted as well as the hidden fields containing the previous page info.

If you have a lot more information to collect or a lot of pages, you might be better off using sessions.

Here's a good tutorial on those:
http://www.tizag.com/phpT/phpsessions.php
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Reply With Quote
  #3 (permalink)  
Old 02-11-09, 03:29 PM
daveganley daveganley is offline
Newbie Coder
 
Join Date: Jun 2003
Location: London UK
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
In the example from therocket954 I think you need to make sure you name the hidden input fields.

<input type="hidden" name="name" value="<?php echo $_POST['name']; ?>" />
<input type="hidden" name="email" value="<?php echo $_POST['email']; ?>" />
etc, etc

The other option is to store the data in a session and keep adding to it each step

Dave
Reply With Quote
  #4 (permalink)  
Old 02-11-09, 03:49 PM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 334
Thanks: 2
Thanked 8 Times in 8 Posts
Oops... good catch dave... Sorry guys
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Reply With Quote
  #5 (permalink)  
Old 02-12-09, 12:06 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Quote:
Originally Posted by davestar057 View Post
Hi Guys,

Okay, I need your fine help.

Okay, so I can do the whole submit a form and send it to email etc...

the problem I have, that I cannot figure out is how to do a "multi step" form??

For example

STEP 1 (YOUR DETAILS)
name
email
age
location


STEP TWO (SETUP ACCOUN DETAILS)

username
password
reminder

STEP THREE (PETS DETAILS

cats name
cats age

etc....

STEP FOUR - DONE - SENDS EMAIL


So like I said I can do all the mechanics of a php form to email address, thats simple...just wondering how I would do the multi part/step form that then sends the info to an email address.

Hope that makes sense.

You guys rock, please help me out

THANK YOU
David
Well it depends on whether you want to use Javascript and PHP or just PHP.

If you use Javascript then you can isolate the different parts of your form in div's inside the form.
And just make the appropriate div visible when needed.

If you want to use just PHP then you could do as therocket954 suggested.
Or you can use sessions to store the values of your form.

Now there is also a way to use Javascript and PHP sessions together by using AJAX.

You must make the decision. And if you need help then come back here.
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Multi script PayPal add to cart order form Tito1 JavaScript 5 02-23-09 04:21 AM
Tute: Create Email based Contact Form Grabber PHP 3 05-31-06 03:11 AM
form to anyone's email with Image Verification ghostrider632 PHP 1 05-11-05 09:08 AM


All times are GMT -5. The time now is 08:29 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.