wright67uk Posted November 19, 2012 Share Posted November 19, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/270896-inserting-form-results-into-a-mysql-db-when-the-form-is-spread-over-2-pages/ Share on other sites More sharing options...
Zane Posted November 19, 2012 Share Posted November 19, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/270896-inserting-form-results-into-a-mysql-db-when-the-form-is-spread-over-2-pages/#findComment-1393498 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.