Jump to content

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


kujina

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.