ek378996 Posted October 16, 2012 Share Posted October 16, 2012 Hello, I am working on a website and I would like to accomplish some things before a form is submitted. Here is what I am trying to do: 1) User fills out form 2) User clicks submit 3) Form results show in a lightbox to ask the user if the information entered is correct 4) If yes, form is sent, if no, taken back to form. I have minimal PHP and Javascript coding knowledge so I'm not totally in the dark with this but I still am not sure how to accomplish it. I have attached an image of the form to give you an idea of what I am working with. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/ Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 (edited) Try finding a lightbox that allows almost anything to be displayed in it. (images, videos, text, etc). It should then be just a case of displaying the data as you usually would. Edited October 16, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385471 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 I am using Joomla! and have a lightbox pluggin that allows me to display html. I'm just not sure the coding it would take to accomplish the task. I haven't touched PHP or Javascript since college about 5 years ago. I can read code and see pretty much what is going on, and modify it, but I'm not sure where to start. Do you have any direction you could point me to see code similiar to what I am trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385472 Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 ive never tried displaying the information in a lightbox - however my 'guess' is that you would have to get the form to submit to itself and use post to display the information inside the lightbox. I cant really give you coding because ive never tried using a lightbox for this reason before. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385476 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 I'm on a time crunch, is there another way to to it you could show me and then I can finagle with the lightbox idea later? Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385477 Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 I will try some things and will post back later today Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385478 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 Thank You! I really appreciate you helping me. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385479 Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 Okay - I wrote this very quickly but: http://www.janedealsart.co.uk/testing_form.php Is this what your looking for? Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385482 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 That is perfect! Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385485 Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 (edited) Here you go then: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <?php /* MAKE THIS LOOK PRETTY TO! */ $sub = $_POST["submit"]; $name = $_POST["name"]; $phone = $_POST["phone"]; $company = $_POST["company"]; $gender = $_POST["gender"]; if($sub){ if(!empty($name)){ if(!empty($phone)){ if(!empty($company)){ if($gender){ echo '<p>Name: '.$name.'</p>'; echo '<p>Phone: '.$phone.'</p>'; echo '<p>Company: '.$company.'</p>'; echo '<p>Gender: '.$gender.'</p>'; echo '<form action="" method="POST">'; echo '<input type="submit" name="con_submit" value="Confirm" />'; echo '<a href="">Wrong</a>'; echo '</form>'; } }else{ $msg .= "No company: "; $link .= '<a href="">Try Again</a>'; } }else{ $msg .= "No telephone number: "; $link .= '<a href="">Try Again</a>'; } }else{ $msg .= "No name: "; $link .= '<a href="">Try Again</a>'; } echo $msg; echo $link; }else{ ?> <form action="" method="POST"> <label>Name:</label> <input type="text" name="name" /><br> <label>Telephone:</label> <input type="text" name="phone" /><br> <label>Company:</label> <input type="text" name="company" /><br> <label>Gender:</label> <select name="gender"> <option>Male</option> <option>Female</option> </select><br> <input type="submit" name="submit" value="Submit" /> </form> <?php } ?> </body> </html> Edited October 16, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385486 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385487 Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 (edited) Good luck with the Lightbox problem itself, sorry I couldn't help with that bit PS: Theres absolutely no security on that form or processing script, so if needed - add some Edited October 16, 2012 by White_Lily Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385488 Share on other sites More sharing options...
Christian F. Posted October 16, 2012 Share Posted October 16, 2012 I strongly recommend taking a look at a previous post I've made, for a much better way to structure your code. Both for your own benefit, and for the ease of use for your users. Not to mention how to add security in the form of validation and output escaping. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385526 Share on other sites More sharing options...
ek378996 Posted October 16, 2012 Author Share Posted October 16, 2012 Christian, I'm using Joomla! with an extension called ProForms. I'm not coding the form myself. It can be found here: http://www.kellywebsitedesign.com/clients/pscb/index.php/order-form I'm looking for a way to be able to grab the inputted user data and simply ask the user if they have selected the right options for their needs. If they have, hit send again and it's sent, if not they go back to the original form and start over. I'm just not sure how to accomplish it. I've writting the people who wrote the pluggin but would much rather learn how to do it myself so i can repeat it as I need to. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385577 Share on other sites More sharing options...
Christian F. Posted October 16, 2012 Share Posted October 16, 2012 (edited) Study the code I linked you to, and read up in the PHP manual if there are some functions you're not familiar with. Should there still be something that you're wondering about, feel free to ask. It's a good idea to note what you've done to figure it out on your own, as well as an clear description of what you're having trouble understanding. Edited October 16, 2012 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/269519-display-form-results-in-lightbox/#findComment-1385664 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.