note 79713 deleted from control-structures.switch by nlopess
| From: | nlopess@php.net | Date: | Mon, 10 Dec 2007 09:45:00 +0000 |
| Subject: | note 79713 deleted from control-structures.switch by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133139@lists.php.net to get a copy of this message | ||
Note Submitter: Nejimakidori
----
Hello..my switch condition does not work and I dont know what's wrong with that.
The codes are following:
<HTML>
<head>
<title>HTML Contact Form</title>
</head>
<body>
<form name="my f" action="Handlecontact.php" method="POST">
First name <input type=text name="firstname" size="20"><br>
Last name <input type=text name="lastname" size="20"><br>
How would you prefer to be contacted:
<select name="ContactHow">
<option value="">Select One:</option>
<option value='Telephone'>
Telephone</option>
<option value='Mail'>Mail</option>
<option value='E-mail'>E-mail</option>
<option value='Fax'>Fax</option>
</select><br>
<input name="add" type="submit" id="add"
value="Submit">
</form>
</body>
</HTML>
<HTML>
<Head>
<title>Contact Information Request</title>
<body>
<form action="HandleContact2.php" method="POST">
<?php
// Pass on the received values using HIDDEN INPUT types.
print ("<input type=hidden name=\"firstname\"
value=\"firstname\">\n");
print ("<input type=hidden name=\"lastname\"
value=\"lastname\">\n");
print ("<input type=hidden name=\"ContactHow\"
value=\"ContactHow\">\n");
switch ($ContactHow){
case "Telephone":
print("<b>Please enter a daytime phone number where you can be
reached:</b><br>\n");
print("<input type=TEXT name=\"telephone\" size=10><br>\n");
print("<input type=submit name=submit value=\"Continue\">\n");
break;
case "Mail":
print("<b>Please enter your complete mailing address:</b><br>\n");
print("<textarea name=\"Mailaddress\" rows=5
cols=40></textarea><br>\n");
print("<input type=submit name=submit value=\"Continue\">\n");
break;
case "E-Mail":
print("<b>Please enter your E-Mail address:</b><br>\n");
print("<input type=TEXT name=\"E-Mail\" size=40><br>\n");
print("<input type=submit name=submit value=\"continue\">\n");
break;
case "Fax":
print("<b>Please enter your Fax number:</b><br>\n");
print("<input type=TEXT name=\"Fax\" size=10><br>\n");
print("<input type=submit name=submit value=\"Continue\">\n");
break;
default:
print("<b>Please go back and select how you would prefer to be
contacted</b><br>\n");
break;
}
?>
</form>
</body>
</Head>
</HTML>
Even I choose any option from drop down menu, the result always comes up with default. I just have
no idea why it does not work..
If anyone could help me, I would appreciate it!!
I am using dreamweaver and phpdev version 4.2.3.
Thank you.