Jump to content

Inserting Form Results Into A Mysql Db, When The Form Is Spread Over 2 Pages?


wright67uk

Recommended Posts

I have a html form which is spread over two pages.

What is the best way to collect information from the two pages and insert them into a single mysql database?

 

Do I carry the results from the first form over to client_start_2.html and then process the the parts of the form together?

Or is best to process the halves of the form seperately somehow?

 

<div id="clientform">
<p>Please enter your details below, and 3 of your local tree surgeons will get in touch! or <a href="login.html">login</a><br /><br/></p>
<form action="client_start_2.html" method="post">
<p class="left"><label for="name" class="required">Your Name</label><br>
<input class="field required" id="name" name="name" placeholder="Your Name" required tabindex="1" type="text" ></p>
<p class="right"><label for="email" class="required">Your Email Address</label><br>
<input class="field required" id="email" name="email" placeholder="Your Email Address" required tabindex="1" type="email"></p>
<div style="clear:both" />
<p class="left"><label for="phone">Your Phone Number</label><br>
<input class="field" id="phone" name="phone" placeholder="Your Phone Number" tabindex="3" type="text"></p>
<p class="right"><label for="postcode">Your Full Postcode</label><br>
<input class="field" id="postcode" name="postcode" placeholder="Your Full Postcode" tabindex="4" type="text"></p>
<div style="clear:both" />
<p class="left"><label for="type" class="required">Type of works</label><br>
<select class="dropdown required" id="type" name="type" required="required" tabindex="9">
<option value=""> Please Select </option>
<option value="1">Tree Surgery</option>
<option value="2">Stump Grinding</option>
<option value="3">Tree Surgery and Stump Grinding</option>
</select></p>
<p class="right"><label for="phone">Ideal Start Date</label><br>
<input class="field" id="phone" name="phone" placeholder="Your Phone Number" tabindex="5" type="text"></p>
<div style="clear:both">
<p class="left"><label for="question" class="required">Brief Description of Works</label><br>
<textarea class="textarea required" id="question" name="question" placeholder="Your Question" required tabindex="10"></textarea></p>
<p class="button"><button tabindex="6" type="submit">Submit</button></p>
<div style="clear:both" />
</form>

 

and then on client_start_2.html;

 

<div id="clientform">
<p>Nearly there... Please choose a username and password, then were all done! <br/><br/></p>
<form action="my-processing-page.php" method="post">
<p><label for="name" class="required">Username</label><br>
<input class="field required" id="name" name="name" placeholder="Your Name" required tabindex="1" type="text" ></p>
<div style="clear:both" />
<p class="left"><label for="password" class="required">Password</label><br>
<input class="field required" id="password" name="password" placeholder="password" required tabindex="2" type="text"></p>
<p class="right"><label for="confirm">Confirm Password</label><br>
<input class="field" id="confirm" name="confirm" placeholder="confirm password" tabindex="3" type="text"></p>
<div style="clear:both" />
<p class="left">Do you agree to the terms and conditions? <br/><input type="radio" value="Yes" name="Yes" > Yes
		 <input type="radio" value="No" name="No"> No
</p>
<p class="button"><button tabindex="6" type="submit">Submit</button></p>
<div style="clear:both" />
</form>	

 

Many thanks

Link to comment
Share on other sites

If you plan to carry variables over multiple pages, your best option is to use SESSIONs which were made specifically for that reason. Read up on Sessions in the PHP Manual, they are very easy to use given you read the instructions.

 

 

Just a quick hint for your future questions.. You will have to store POST or GET data into these SESSIONS. That is how you will accomplish what you are trying to do.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.