Jump to content

Basic Drop Down Menu Issues


collbrankid

Recommended Posts

I'm wondering if someone can help me out with this basic drop down menu question. I just want both of the drop down menu results to be sent to my e-mail. Right now, only the name form results are showing up in my e-mail. I know this is basic, but I thought I might be able to get some quick help on this forum.

 

The two drop down menus are:

(1) Class Year: Freshman, Sophomore, Junior, Senior.

(2) "How did you hear about us": Word of Mouth, Browsing the Internet, Newspaper/Magazine, other.

 

What do I need to do to fix this? Thanks in advance.

Below is the code for my "feedback.php" page:

 

<?

$mailto = '[email protected]' ;

 

$subject = "Registration Results" ;

 

$formurl = "http://www.nationalcollegiatevolunteers.org/test.html" ;

$errorurl = "http://www.nationalcollegiatevolunteers.org/test2.html" ;

$thankyouurl = "http://www.nationalcollegiatevolunteers.org/submission.html" ;

 

$uself = 0;

 

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;

$name = $_POST['name'] ;

$email = $_POST['email'] ;

$college = $_POST['college'] ;

$major = $_POST['major'] ;

$classyear = $_POST['classyear'] ;

$find = $_POST['find'] ;

$comments = $_POST['comments'] ;

 

if($_POST['classyear'] == "Freshman")

{

$sendto = "[email protected]";

$name = $_POST['name'];

$email = $_POST['email'];

$classyear = $_POST['Freshman'];

$classyear = $_POST['classyear'] ;

$comments = $_POST['comments'];

 

if($_POST['classyear'] == "Sophomore")

{

$sendto = "[email protected]";

$name = $_POST['name'];

$email = $_POST['email'];

$classyear = $_POST['Sophomore'];

$classyear = $_POST['classyear'] ;

$comments = $_POST['comments'];

 

 

mail( "$sendto", "Feedback From Site",

"Name: $name\n\n$message",

"From: $name" );

 

 

$http_referrer = getenv( "HTTP_REFERER" );

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (empty($name) || empty($email) || empty($comments)) {

  header( "Location: $errorurl" );

  exit ;

}

if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {

header( "Location: $errorurl" );

exit ;

}

 

if (get_magic_quotes_gpc()) {

$comments = stripslashes( $comments );

}

 

$messageproper =

 

"This message was sent from:\n" .

"$http_referrer\n" .

"------------------------------------------------------------\n" .

"Name of sender: $name\n" .

"Email of sender: $email\n" .

"College/University: $college\n".

"Major: $major\n" .

 

 

"-----------What would you like to get our of the New Orleans Pilot Trip?-------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

mail($mailto, $subject, $messageproper,

"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

header( "Location: $thankyouurl" );

exit ;

 

?>

 

Below is the code for my "test.html" page:

 

    <form action="feedback.php" method="post">

     

<table border="0" cellpadding="3" cellspacing="1" summary="feedback form">

 

<tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>

<tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>

<tr><td>College/University:</td><td><input type="text" name="college" size="25" /></td></tr>

<tr><td>Major:</td><td><input type="text" name="major" size="25" /></td></tr>

 

<tr><td></td><td></td></tr>

 

<td> Class Year: <select name="classyear">

<option value="Freshman">Freshman</option>

<option value="Sophomore">Sophomore</option>

<option value="Junior">Junior</option>

<option value="Senior">Senior</option></select><br><br>

 

<td> How did you hear about us? <select name="find">

<option value="Freshman">Word of Mouth</option>

<option value="Sophomore">Browsing the Internet</option>

<option value="Junior">Newspaper/Magazine</option>

<option value="Senior">Other</option></select><br><br>

 

 

<tr><td></td><td></td></tr>

 

<td colspan="2">

What would you like to get out of the New Orleans Pilot Trip?<br />

<textarea rows="10" cols="53" name="comments"></textarea>

</td>

</tr>

<tr>

<td align="center" colspan="2">

<input type="submit" value="Register" /><br />

<a href="http://www.thesitewizard.com/">Powered by thesitewizard.com</a>

</td>

</tr>

</table>

</form>

Link to comment
https://forums.phpfreaks.com/topic/60123-basic-drop-down-menu-issues/
Share on other sites

The two drop down menus are:

(1) Class Year: Freshman, Sophomore, Junior, Senior.

(2) "How did you hear about us": Word of Mouth, Browsing the Internet, Newspaper/Magazine, other.

 

 

Do like this:

$year=$_POST['Class Year'];

$hear=$_POST['Hear'];//this is for the selection list about how did u hear about us

now u have the appropriate selected values which u can use to send the email.

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.