tork Posted January 13, 2014 Share Posted January 13, 2014 After checking all the posts on this forum, I tried more caffeine but it didn't work Although this code is within a php script, I believe the issue is an html one (thus this forum), so please ignore the php: The form contains text, radio and select inputs. They are able to be input by the user, yet when I test for them being posted once the script is accessed after posting, the text and select values succeed but the radio values are nil. Form Code: <form method="post" class="" action="script.php"> <div class="row"> <label for="pronounce_name_as">How is your name pronounced?</label> <label id="label_instrn">Optional: for use with ideographic characters such as used in some Asian cultures</label> <input type="text" id="pronounce_name_as" name="pronounce_name_as" value="<?php if (isset($trimmed['pronounce_name_as'])) echo $trimmed['pronounce_name_as']; ?>" /> </div> <div class="row"> <label id="label_radio">Gender *</label> <input id="female" type="radio" name="gender" value='female' /> Female<br /> <input id="male" type="radio" name="gender" value='male' /> Male<br /> </div> <div class="row"> <label id="label">Communications</label> <label id="label_instrn">Optional: this will help us provide you with appropriate study styles</label> <select id="label_select" name="comms" > <option value='not_selected' selected>Select ..</option> <option value='wo_speech'>I am without speech</option> <option value='wo_hearing'>I am without hearing</option> <option value='wo_sight'>I am without sight</option> <option value='None'>None of the above</option> </select> </div> </form> Value test code: echo "posted pronounce_name_as = ".$_POST['pronounce_name_as']."<br />";echo "posted gender = ".$_POST['gender']."<br />";echo "posted comms = ".$_POST['comms']."<br />";var_dump($_POST['gender']); Output: posted pronounce_name_as = Jai-ms Smy-lyposted gender =posted comms = None string(0) "" Any ideas? Should I return to html bootcamp? Quote Link to comment Share on other sites More sharing options...
kicken Posted January 13, 2014 Share Posted January 13, 2014 Your code suggests the field is being posted, just with an empty value. There is nothing wrong with your HTML however so I suspect one of two things 1) You have some PHP code you did not show which is causing the value to be cleared out or 2) You have some JS code you did not show which is causing the value to be cleared out. Check your browser's developer tools to see what value is being sent in the request to the server. You can find this out from the Net/Network tab usually. Note for future posts, you need to wrap your code in tags when posting. It makes it much easier to read that way. Quote Link to comment Share on other sites More sharing options...
tork Posted January 13, 2014 Author Share Posted January 13, 2014 (edited) Thanks for your advice, kicken. Point on code wraps taken. I checked web console on firefox and it shows no data sent for radio inputs. Now this gets exhilarating! Whatever is causing this is refusing to accept radio selected data or is deleting radio selected data values before it gallops down to the server. My php code certainly is not involved at the form. And the javascript has nothing to do with these inputs - it's only used for email and pw graphics. Now I'm stumped. Any other ideas or hints? Mmm .. time for a 'candy bar to brain' moment, methinks. Edited January 13, 2014 by tork Quote Link to comment Share on other sites More sharing options...
tork Posted January 14, 2014 Author Share Posted January 14, 2014 Found out what causes this, and you're correct, it is jQuery: $(function(){ /* This is shorthand for $(document).ready(function(){ which ensures all jQuery items are loaded before executing */ }); It's not the coding inside it, but just this one statement. Guess I'm off to the javascript forum now Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.