Jump to content

Problems with Enquiry Form


Baggy

Recommended Posts

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.

Link to comment
Share on other sites

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 by Wickham
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by jlhaslip
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...