chrispos Posted February 17, 2011 Share Posted February 17, 2011 Hi All, and thanks for your help on my last problem now solved. What i am doing is building a job site and it needs info put in from job seekers regarding their qualifications. Some will have 2 some may have 10 and so on. I need to set up a system that I can put say 10 text boxes in a form that can then go in a MySQL. I only want the filled out boxes to go into the database and not the ones left blank. I have no idea as to where to start with but I think I need to loop through until it comes to the last filled out box but not enter the blank text boxes. i have no idea where to start on this one so if any one has thoughts on this it would be great. Thank you all for your help in the past. Quote Link to comment Share on other sites More sharing options...
w1n78 Posted February 17, 2011 Share Posted February 17, 2011 something like these? http://www.weberdev.com/get_example-4689.html or http://viralpatel.net/blogs/2009/01/dynamic-add-textbox-input-button-radio-element-html-javascript.html here's what i googled... http://www.google.com/search?q=javascript+dynamic+form+fields then you can use a loop in php to do your insert Quote Link to comment Share on other sites More sharing options...
chrispos Posted February 17, 2011 Author Share Posted February 17, 2011 Thank you its the loop I am after. The box link was great but it is getting the number of boxes then loop through then the insert and that is the bit I have no idea with. I hope that makes sense. I normally use $something = $_POST['something'] But in this case I would not know how many boxes and what they were called. Quote Link to comment Share on other sites More sharing options...
w1n78 Posted February 17, 2011 Share Posted February 17, 2011 here's something to get you started. <form method="post" action="some_page.php"> <input name="qualification[]" type="text" /><br /> <input name="qualification[]" type="text" /><br /> <input name="qualification[]" type="text" /> <input type="submit" value="submit" id="submit" name="submit" /> </form> if (isset($_POST['submit'])) { for ($i=0; $i<count($_POST['qualification']); $i++) { if ($_POST['qualification']) { // insert into database } } } that's just a quick code off the top of my head. there may be syntax errors but i hope you get the idea. there are other ways but this is the "quick and dirty" way. Quote Link to comment 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.