note 79713 added to control-structures.switch

From: Date: Mon, 10 Dec 2007 05:57:17 +0000
Subject: note 79713 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-133135@lists.php.net to get a copy of this message
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. ---- Server IP: 219.94.145.73 Probable Submitter: 220.238.26.222 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/79713 Del: integrated -- https://master.php.net/note/delete/79713/integrated Del: useless -- https://master.php.net/note/delete/79713/useless Del: bad code -- https://master.php.net/note/delete/79713/bad+code Del: spam -- https://master.php.net/note/delete/79713/spam Del: non-english -- https://master.php.net/note/delete/79713/non-english Del: in docs -- https://master.php.net/note/delete/79713/in+docs Del: other reasons-- https://master.php.net/note/delete/79713 Reject -- https://master.php.net/note/reject/79713 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#133135) next »