Jump to content

[SOLVED] "Drop Down" selection required selections - Help!


Recommended Posts

Hi

 

I'm very new to php, I will buy a good book on it soon (recommendations?)

 

I have been asked to put up a contact form for a school website.

It needs to go live very soon (wednesday afternoon) so I would appreciate any help.

 

I'm using the contact form here http://www.ibdhost.com/contact/

 

On the following drop down list I'm going to have it start on "Please Select a Subject" and then require the user to select one of the subsequent options:

 

Questions/feedback Relating to:<br />
<select name="attn" size="1">
<option value=" select ">Please Select a Subject </option>
<option value=" My Childs Education ">My Childs Education </option>
<option value=" Student Welfare ">Student Welfare </option>  
<option value=" Communications ">Communications </option> 
<option value=" General Education Issues ">General Education Issues </option> 
</select>

 

What do I need to do to make it so a user must not have "Please Select a Subject" selected?

 

 

This is what I have so far.

 

http://www.chalvedon.com/contact/contact.php

 

...Thanks...

I think this is what you mean? Try this:

 

Questions/feedback Relating to:<br />
<select name="attn" size="1">
<option value="" disabled="disabled">Please Select a Subject</option>
<option value=" My Childs Education ">My Childs Education </option>
<option value=" Student Welfare ">Student Welfare </option>  
<option value=" Communications ">Communications </option> 
<option value=" General Education Issues ">General Education Issues </option> 
</select>

Hi,

 

Referring

Questions/feedback Relating to:<br />

<select name="attn" size="1">

<option value=" select ">Please Select a Subject </option>

<option value=" My Childs Education ">My Childs Education </option>

<option value=" Student Welfare ">Student Welfare </option> 

<option value=" Communications ">Communications </option>

<option value=" General Education Issues ">General Education Issues </option>

</select>

 

 

<option value=" select ">Please Select a Subject </option> change this to <option value="">Please Select a Subject </option>

 

When you will post check trim($_POST['attn']) != ''. i.e attn should not be empty.

 

regards

 

 

 

Hi

 

Thanks for all the responses, this looks like a nice active forum!

 

I basically dont know anything about php or any other scripting language, so I'm quite happy that I'm coping so far!

 

I managed to get it working how I wanted, I used the following in contact.php

 

Questions/feedback Relating to:<br />

<select name="attn" size="1">

<option value="">Please Select a Subject</option>

<option value="My Childs Education">My Childs Education </option>

<option value="Student Welfare">Student Welfare </option> 

<option value="Communications">Communications </option>

<option value="General Education Issues">General Education Issues </option>

</select>

 

And I used the following in sendeail.php

 

if(empty($attn))

{

echo "<h2>Use Back & Select a question subject from the drop down menu</h2>\n";

$badinput = "<h2>Message was NOT submitted</h2>\n";

echo $badinput;

die ("← Go back!");

}

 

 

My mistake when experimented with it originally, was having a space between the empty quotes " "

 

Thanks a lot everyone

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.