Baggy Posted February 12, 2009 Report Posted February 12, 2009 We are trying to put the finishing touches to a second Enquiry Form for one of our sites. I have asked questions about this site (different topic) previously and have been advised that the 'updating' we are doing would be better served by switching from a 'nested tables' design to CSS - no argument with that but time is a problem. We need to get the site 'live' in it's updated form as soon as possible, so the conversion to CSS will have to follow in a little while. After that long-winded intro - my question(s):- Some of the input boxes (excuse incorrect terminology please) need to be mandatory to allow submission and this is causing some head scratching. One such section of the form is where we want to ask the 'enquirer' to insert either a Home, Work or Mobile number. However, the code the person helping us has used, will only accept all numbers inserted. Is there a way to instruct the form to accept any 1 of the 3 possible inputs? There are other issues but I don't want to 'push my luck'! Any help will be much appreciated. Quote
Wickham Posted February 12, 2009 Report Posted February 12, 2009 (edited) I expect that there must be PHP code to check for the empty boxes, which returns true (they are empty) and an error page. It will look something like this:- // Code to check for empty input boxes elseif (empty($email) || empty($name) || empty($subject) || empty($component) || empty($size)) { header( "Location: $errorurl" ); } which will need editing to take out the field (variable) relating to the boxes that you do not want to raise an error when empty. Without seeing the PHP code, it's just my guess. Edited February 12, 2009 by Wickham Quote
Baggy Posted February 12, 2009 Author Report Posted February 12, 2009 Thank you <?php print stripslashes($_REQUEST['name']); ?> Your message has been sent Click here to continue Dreamweaver Spot by dreamweaverspot.com Quote
jlhaslip Posted February 13, 2009 Report Posted February 13, 2009 That script is looking for: - some bad header input to prevent Email headers being included, - valid email address - blank inputs - referrer logging But no validity checking for a Phone number, except whether is it blank... Simply write a check for the number formats you wish to allow. What does the Form look like? Does it ask for the phone numbers as an array? The form outline being checked above is a generic form handler that does not indicate which fields are being passed. It is also using the REQUEST method, which is not recommended. The form should be using the POST method for better security. REQUEST can be spoofed with an URL query string. Quote
Baggy Posted February 13, 2009 Author Report Posted February 13, 2009 Thanks - I sort of follow what you're saying, Can you suggest where I might see samples of the Request-type code please? Quote
Baggy Posted February 14, 2009 Author Report Posted February 14, 2009 Sorry - I meant samples of POST method - doh! Quote
jlhaslip Posted February 14, 2009 Report Posted February 14, 2009 (edited) First up in Google : http://www.ibdhost.com/contact/ function based version : http://inobscuro.com/tutorials/read/34/ looks fair to middling. None of the Google-found scripts will be plug-n-play. They are all going to need tweaking to some degree. Add fields, check input, secure data, etc. I haven't found one yet that works out of the box to do everything. Google Query was : php contact scripts using POST method and this produced a ton of examples. Edited February 14, 2009 by jlhaslip Quote
Baggy Posted February 14, 2009 Author Report Posted February 14, 2009 jlhaslip - many thanks for that, will do some reading then experiment, cheers. Quote
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.
Note: Your post will require moderator approval before it will be visible.