forms - Select option in PHP not echoing back correctly -
as precursor, worth mentioning new @ php. i've spent 3 hours working on seems should simple fix.
using php echo form after choosing submit, drop-down menu echoing first name, regardless of 1 selected.
here code:
<form action="echo_form_email.php" method="get"> <p> <div id="cheddar">cashier: <input id="cashier" name="cashier" type="text"></div> </p> <p> <div id="q">did cashier front register?</div> <div id="radio1"><input type="checkbox" name="front_register" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="front_register" value="no">no</div> <div id="radio3"><input type="checkbox" name="front_register" value="n/a">n/a</div> </p> <p> <div id="q">genuinely greet customer eye contact?</div> <div id="radio1"><input type="checkbox" name="greets" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="greets" value="no">no</div> </p> <p> <div id="q">scan/unload b.o.b. (if no bagger)</div> <div id="radio1"><input type="checkbox" name="scan_bob" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="scan_bob" value="no">no</div> <div id="radio3"><input type="checkbox" name="scan_bob" value="n/a">n/a</div> </p> <p> <div id="q">carry conversation around product in basket or genuine conversation?</div> <div id="radio1"><input type="checkbox" name="conversation" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="conversation" value="no">no</div> <div id="radio3"><input type="checkbox" name="conversation" value="n/a">n/a</div> </p> <p> <div id="q">offer buddy bucks parent @ beginning of order?</div> <div id="radio1"><input type="checkbox" name="buddy" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="buddy" value="no">no</div> <div id="radio3"><input type="checkbox" name="buddy" value="n/a">n/a</div> </p> <p> <div id="q">avoid side conversations?</div> <div id="radio1"><input type="checkbox" name="side_conversation" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="side_conversation" value="no">no</div> </p> <p> <div id="q">point out , circle savings?</div> <div id="radio1"><input type="checkbox" name="savings" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="savings" value="no">no</div> <div id="radio3"><input type="checkbox" name="savings" value="n/a">n/a</div> </p> <p> <div id="q">offer carryout (if no bagger)?</div> <div id="radio1"><input type="checkbox" name="carry_out" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="carry_out" value="no">no</div> <div id="radio3"><input type="checkbox" name="carry_out" value="n/a">n/a</div> </p> <p> <div id="q">give genuine "thank you"?</div> <div id="radio1"><input type="checkbox" name="thanks" value="yes">yes</div> <div id="radio2"><input type="checkbox" name="thanks" value="no">no</div> </p> <p> <div id="cheddar">digital signature</div> <div id="cheddar"><input type="tel" name="sign1" placeholder="peoplesoft id"></div> </p> <p> <div id="auditingasm">asm performing audit: <br /> <select name="asm"> <option value="john doe">john doe</option> <option value="jane doe">jane doe</option> <option value="little doe">little doe</option> <option value="big doe">big doe</option> </select> </p> <br /> <input type="submit" value="submit" name="submit"> <input id="reset" type="reset"> </form>
using above code, regardless of option choose before submitting, echoed results come "john doe."
here php:
<?php if (! empty($_get['cashier'])){ echo 'cashier receiving audit: ' . $_get['cashier']; } echo "<br />"; if (! empty($_get['asm'])){ echo 'asm performing audit: ' . $_get['asm']; } echo "<br /><br />"; if (! empty($_get['front_register'])){ echo 'did cashier front register? ' . $_get['front_register']; } echo "<br />"; if (! empty($_get['greets'])){ echo 'greet customer eye contact? ' . $_get['greets']; } echo "<br />"; if (! empty($_get['scan_bob'])){ echo 'scan/unload bob (if no bagger) ' . $_get['scan_bob']; } echo "<br />"; if (! empty($_get['conversation'])){ echo 'conversation groceries, or other genuine conversation? ' . $_get['conversation']; } echo "<br />"; if (! empty($_get['buddy'])){ echo 'offer buddy bucks parent @ beginning of order? ' . $_get['buddy']; } echo "<br />"; if (! empty($_get['side_conversation'])){ echo 'no side conversations? ' . $_get['side_conversation']; } echo "<br />"; if (! empty($_get['savings'])){ echo 'cashier pointed , circled savings? ' . $_get['savings']; } echo "<br />"; if (! empty($_get['carry_out'])){ echo 'offered carry out (if no bagger) ' . $_get['carry_out']; } echo "<br />"; if (! empty($_get['thanks'])){ echo 'genuine "thank you?" ' . $_get['thanks']; } echo "<br /><br />"; if (! empty($_get['sign1'])){ echo 'digital signature: ' . $_get['sign1']; } ?>
my in advance
your select statement seems syntactically correct. try validating form , check output.
<select name="asm" onchange="return validate(this);"> <option value="">select option</option> <option value="john doe">john doe</option> <option value="john doe">john doe</option> <option value="jane doe">jane doe</option> <option value="little doe">little doe</option> <option value="big doe">big doe</option> </select> <script type="text/javascript"> function validate(obj){ alert (obj.value); return false; } </script>
this alert value selected without passing form next page testing.
and forgot close div tag select statement.
Comments
Post a Comment