Hey Hopers, what I'm trying to do is pull information from my database and display it in html form fields, I'v already worked out how to do this for text but I'm unsure of how to do it with HTML Form Fields like Radio, Checkbox and Select.
What i'm trying to do currently is pull the result from the database and if the result=male it automatically checks male as active and if result=female it automatically checks female as active, I'm assuming this would definitely be something to do with the IF statement, just not sure how to work it.
I have used includes to include other files which connect it to the database, fetches and sets up defined variables for $row's, If anyone believe they may be the issue please let me know and I'll post the code for those, I'm assuming they're correct since it's working to fill in all of the text fields but I'm happy to post it in case I'v missed something
I tried this below;
<input type="radio" name="gender" id="gender" value="male"<?php
if ($row['gender'] == 'male') echo "checked";
?>>
But for some reason it's not working, I'm using MySQLi fetch statements to ready the data for insertion and up until now it's worked well, inserting text into textfields brilliantly.
PrtScr example;
I haven't got to the birthdate fields yet but I'm sure i'll need some help putting the data from the DB into those as well if anyone cares to help, I'm thinking I'll store them with a string so when pulling them back out I'll likely have to decipher the string and split it back up and then once again I'd assume it'll be more IF statements, quite a lot i'd assume to tell the form what to do with it.
Any help with either/both things would be greatly appreciated, Haven't done PHP like this for quite some time and to top it off I'm learning MySQLi and PDO as I go so my mind is somewhat scrambled.
Thank you in advance CH'ers