Hopemanjohn Posted November 24, 2012 Share Posted November 24, 2012 Hi I have a form (say Form 1) which saves its input to a Mysql DB called jos_chronoforms_data_travel_itinerary. There is one key field within the DB which uniquely identifies each record. It is called serial_number. I then have another form (say Form 2) which just asks the user to input the Serial Number. On submit it brings up a form (say Form 3), which is a copy of form 1 and populates it with the record matching the number entered for editing. All works well. However, What I want to do is write a simple script which will look at the number a user enters into the Serial Number of Form 2 and if it matches a number in the field serial_number of the DB then actions the form as is. But if a number is entered it just redirects back to a blank Form 2 awaiting the user to enter again. Help??? Quote Link to comment https://forums.phpfreaks.com/topic/271107-evaluate-field-in-db/ Share on other sites More sharing options...
50r Posted November 24, 2012 Share Posted November 24, 2012 post your code lets build it from your idea. do you want the serial number to be checked on submit or bihind the seen? Quote Link to comment https://forums.phpfreaks.com/topic/271107-evaluate-field-in-db/#findComment-1394760 Share on other sites More sharing options...
Hopemanjohn Posted November 24, 2012 Author Share Posted November 24, 2012 (edited) Hi 50r, Thanks for your reply. This is the code for Form 1: <div class="ccms_form_element cfdiv_text" id="tracker_11_container_div" style=""><label>Serial Number:</label><input maxlength="14" size="14" class=" validate['required','number']" title="" type="text" value="" name="tracker_1" /> <div class="clear"></div><div id="error-message-tracker_1"></div></div><div class="ccms_form_element cfdiv_text" id="name_11_container_div" style=""><label>Name:</label><input maxlength="150" size="30" class=" validate['required']" title="" type="text" value="" name="name_1" /> <div class="clear"></div><div id="error-message-name_1"></div></div><div class="ccms_form_element cfdiv_text" id="email_11_container_div" style=""><label>E-mail Address:</label><input maxlength="150" size="30" class=" validate['required','email']" title="" type="text" value="" name="email_1" /> <div class="clear"></div><div id="error-message-email_1"></div></div><div class="ccms_form_element cfdiv_textarea" id="travel_11_container_div" style=""><label>Description</label><textarea cols="100" rows="8" class="" title="" name="travel_1"></textarea> <div class="clear"></div><div id="error-message-travel_1"></div></div><div class="ccms_form_element cfdiv_submit" id="submit_11_container_div" style="text-align:center"><input name="submit_1" class="" value="Submit" type="submit" /> <div class="clear"></div><div id="error-message-submit_1"></div></div> This is the code for Form 2: <div class="ccms_form_element cfdiv_text" id="tracker_11_container_div" style=""><label>Enter Serial Number:</label><input maxlength="14" size="14" class=" validate['required','number']" title="" type="text" value="" name="tracker_1" /> <div class="clear"></div><div id="error-message-tracker_1"></div></div><div class="ccms_form_element cfdiv_submit" id="submit_21_container_div" style="text-align:center"><input name="submit_2" class="" value="Edit Product" type="submit" /> <div class="clear"></div><div id="error-message-submit_2"></div></div> This is the code for Form 3: <input type="hidden" value="" name="cf_id" /> <div class="ccms_form_element cfdiv_text" id="tracker_11_container_div" style=""><label>Serial Number:</label><input maxlength="14" size="14" class=" validate['required','number']" title="" type="text" value="" name="tracker_1" /> <div class="clear"></div><div id="error-message-tracker_1"></div></div><div class="ccms_form_element cfdiv_text" id="name_11_container_div" style=""><label>Name:</label><input maxlength="150" size="30" class=" validate['required']" title="" type="text" value="" name="name_1" /> <div class="clear"></div><div id="error-message-name_1"></div></div><div class="ccms_form_element cfdiv_text" id="email_11_container_div" style=""><label>E-mail Address:</label><input maxlength="150" size="30" class=" validate['required','email']" title="" type="text" value="" name="email_1" /> <div class="clear"></div><div id="error-message-email_1"></div></div><div class="ccms_form_element cfdiv_textarea" id="travel_11_container_div" style=""><label>Description:</label><textarea cols="100" rows="8" class="" title="" name="travel_1"></textarea> <div class="clear"></div><div id="error-message-travel_1"></div></div><div class="ccms_form_element cfdiv_submit" id="submit_21_container_div" style="text-align:center"><input name="submit_2" class="" value="Submit" type="submit" /> <div class="clear"></div><div id="error-message-submit_2"></div></div> I hope it makes sense ? Checked on submit would be better I think!! Edited November 24, 2012 by Hopemanjohn Quote Link to comment https://forums.phpfreaks.com/topic/271107-evaluate-field-in-db/#findComment-1394793 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.