0
<?php    
require_once('upper.php');
require_once('LoginStatement.php');
require_once('database.php');
echo $error_msg='';
require_once('database.php');
        $LoginId=$_COOKIE['LoginIdCookie'];
        $query="select * from registration where LoginId='$LoginId'";
        $result=mysqli_query($dbc,$query);
        $row=mysqli_fetch_array($result);
if(isset($_POST['submit']))
{
$LoginId=mysqli_real_escape_string($dbc,trim($_POST['LoginId']));
$Name=mysqli_real_escape_string($dbc,trim($_POST['Name']));
$Age=mysqli_real_escape_string($dbc,trim($_POST['Age']));
$BloodGroup=mysqli_real_escape_string($dbc,trim($_POST['BloodGroup']));
if(!isset($_POST['Sex']))
{
echo 'Please enter Sex<br>';
}
else{
$Sex= mysqli_real_escape_string($dbc,trim($_POST['Sex']));
}
$Qualification=mysqli_real_escape_string($dbc,trim($_POST['Qualification']));
$ContactNumber=mysqli_real_escape_string($dbc,trim($_POST['ContactNumber']));
$Email=mysqli_real_escape_string($dbc,trim($_POST['Email']));
$Address=mysqli_real_escape_string($dbc,trim($_POST['Address']));
$AboutYourself=mysqli_real_escape_string($dbc,trim($_POST['AboutYourself']));
//$countCheck=count($_POST['checkbox']);
//echo $countCheck;
//$checkbox=$_POST['checkbox'];
//$countCheck=count($checkbox);
    if(empty($LoginId)){echo 'Please enter Login Id';}
        elseif(empty($Name)){echo 'Please enter Name';}
        elseif(empty($Age)){echo 'Please enter Age';}
        elseif(!isset($_POST['Sex'])){}
        elseif(empty($Qualification)){echo 'Please enter Qualification';}
        elseif(empty($ContactNumber)){echo 'Please enter Contact Number';}
        elseif(empty($Email)){echo 'Please enter Email';}
        elseif(empty($Address)){echo 'Please enter Address';}
        elseif(empty($AboutYourself)){echo 'Please enter About Yourself';}

        else
        {

        if(mysqli_num_rows($result)==0) 
        {           
        $checkbox=$_POST['checkbox'];
        $countCheck=count($_POST['checkbox']);
        $reg_id=' ';
        for($i=0;$i<$countCheck;$i++)
        {
        $reg_id=$reg_id.$checkbox[$i].',';
        }
        $query="UPDATE registration SET (LoginId,Name,Age,BloodGroup,Sex,Qualification,ContactNumber,Email,Address,AboutYourself,Activity)values ('$LoginId',SHA('$Password1'),'$Name','$Age','$BloodGroup','$Sex','$Qualification','$ContactNumber','$Email','$Address','$AboutYourself',',$reg_id')";
        $result=mysqli_query($dbc,$query) or die("Not Connect");

        echo ' Dear '.$Name.'.<br>Your request has been mailed to admin.<br>Your account is waiting for approval<br>';
        $from= 'Elite Brigade';
        $to='ankitp@rsquareonline.com';
        $subject='New User Registration';
        $message="Dear admin,\n\nA new user request for registration. Please check it out.\n\nRegards\nMicro";
        mail($to,$subject,$message,'From:'.$from);
        //header('Location: index.php');
        //  header('Location: Registration.php');
        }
        else
        {
        echo 'Dear '.$Name. ', <br> An account already exist with login-id<b> '.$LoginId.'</b> <br>Please try another login-id';
        }}  
}       
?>

<html>
<head>
<script src="jquery-latest.js"></script>
  <script type="text/javascript" src="jquery-validate.js"></script>
<style type="text/css">
* { font-family: Verdana;  }

label.error {  color: white;  padding-left: .5em; }
p { clear: both; }
.submit { margin-left: 12em; }
em { font-weight: bold; padding-right: 1em; vertical-align: top; }
</style>
  <script>
  $(document).ready(function(){
    $("#commentForm").validate();
  });
  </script>

</head>

<body>

<?php 
echo $error_msg; ?>

<form action='<?php echo $_SERVER['PHP_SELF'];?>' id="commentForm" method='post'>
<div class="registration_and_activity">

<table border="0" width="380">
<tr><td colspan="2">
<h3>Update Personal Details</h3></td></tr>
<tr><td width="120">

<em>*</em>Enter Login id</td><td width="150"><input type='text' name='LoginId' minlength='4'  value='<?php echo $row['LoginId']; ?>' /></td></tr>

<tr><td width="120">
<em>*</em>Enter Name</td> <td><input type='text'  name='Name' value='<?php echo $row['Name'];?>' /></td></tr>
<tr><td>
<em>*</em>Enter Age</td><HEAD>
   <SCRIPT language=Javascript>

      function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }



   </SCRIPT>
   </HEAD>
<td><INPUT onkeypress='return isNumberKey(event)'  type='text' name='Age' value='<?php echo $row['Age'];?>'/></td></tr>

<tr><td>
<em>*</em>Enter Blood</td><td><input type='text' name='BloodGroup' value='<?php echo $row['BloodGroup'];?>' /></td></tr>

[B]<tr><td>
<em>*</em>Enter Sex</td><td><input type='radio' name='Sex'  style='width:16px; border:0;' value='Male' checked='<?php if($row['Sex']='Male') echo 'checked';?>'/>Male   <input type='radio' name='Sex' checked='<?php if($row['Sex']='Female') echo 'checked';?>' style='width:16px; border:0;' 'value='Female' />Female</td></tr>[/B]

<tr><td>
<em>*</em>Enter Qualification</td><td><input type='text' name='Qualification'  value='<?php echo $row['Qualification'];?>' /></td></tr>

<tr><td>
<em>*</em>Contact Number </td><td><input onkeypress='return isNumberKey(event)'type='text'  name='ContactNumber' value='<?php echo $row['ContactNumber'];?>' /></td></tr>

<tr><td>
<em>*</em>Enter Email</td><td><input type='text' name='Email'class="email" value='<?php echo $row['Email'];?>' /></td></tr>

<tr><td>
<em>*</em>Enter Address</td><td><input type='text'   name='Address' value='<?php echo $row['Address'];?>' /></td></tr>


<tr ><td >
<em>*</em>About Yourself </td></tr>
<tr><td colspan="2"><textarea rows='10' cols='40'  name='AboutYourself'  /><?php echo $row['AboutYourself'];?></textarea></td></tr>
<tr><td>

<?php 

echo "<tr><td colspan='2' align='center'><input type='submit' value='Update' name='submit' style='background:url(./images/button_img2.png) no-repeat 10px 0px; width:100px; padding:3px 0 10px 0; color:#FEFBC4; border:0;'/></td></tr><br>";

echo " </td></tr></table>

</div>

</form>
</body>
</html>";
require_once('lower.php');

?>

Hi friends..........
In above code I want that In database if Sex=Male then Male radio button will be checked automatically and if Sex =Female then Female radio button will be checked.
But it not works ...........
Plz help me...........
Thx in advance..........

Edited by mike_2000_17: Fixed formatting

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by ankit.pandey3
0

try this:

<input type='radio' name='Sex'  style='width:16px; border:0;' value='Male' <?php if($row['Sex']='Male') echo 'checked=checked';?>/>Male   <input type='radio' name='Sex' <?php if($row['Sex']='Female') echo 'checked=checked';?> style='width:16px; border:0;' 'value='Female' />

please check quotes ..

0

try this:

<input type='radio' name='Sex'  style='width:16px; border:0;' value='Male' <?php if($row['Sex']='Male') echo 'checked=checked';?>/>Male   <input type='radio' name='Sex' <?php if($row['Sex']='Female') echo 'checked=checked';?> style='width:16px; border:0;' 'value='Female' />

please check quotes ..

Thx boss it works..........

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.