hi friends this code were using in the update form but it not working properly where "$dd is nothing but num_fetch _array rows and rgender is nothing but database field name"
<input type="radio" name="sex" <?php if($dd['rgender']=="male") {?> checked <?php } ?> id="male" value="male">male
<input type="radio" name="sex" <?php if($dd['rgender']=="female"){?> checked <?php } ?> id="female" value="female">female
syntax problem
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: syntax problem
What you could do is set a "checked" variable outside of the form element:
i.e.
i.e.
Code: Select all
<?php
$mChecked="";
$fChecked="";
if($dd['rgender']=="male") {
$mChecked="checked";
} elseif($dd['rgender']=="female") {
$fChecked="checked";
}
?>
<input type="radio" name="sex" <?php echo $mChecked; ?> id="male" value="male">male
<input type="radio" name="sex" <?php echo $fChecked; ?> id="female" value="female">female
- JamesRavenscroft
- Forum Newbie
- Posts: 10
- Joined: Thu Jan 31, 2008 3:45 am
- Location: West Midlands, United Kingdom
Re: syntax problem
Hey itarun
Have you made sure that there is no error in your mysql query? Be sure to do a "print mysql_error();" to make sure this is not the case.
Also, see if there is anything in the $dd array by doing "print_r($dd);"
That will print all of the data (if any) in that variable like Array(key => value, key=> value)
Have you made sure that there is no error in your mysql query? Be sure to do a "print mysql_error();" to make sure this is not the case.
Also, see if there is anything in the $dd array by doing "print_r($dd);"
That will print all of the data (if any) in that variable like Array(key => value, key=> value)