Hi i have a date of birth for members in registration form but in the couples profile im adding a date of birth for both members in the couples group as in the pics included

heres the coding for it from the profile page can anyone help be much appreciated ty jan x

$user_birthdate = $fetch_user['user_birthdate'];
$puser_birthdate = $fetch_info['puser_birthdate'];



<tr>
    <td><?php echo Age($user_birthdate);?> year old</td>
    <td><?php echo Age($puser_birthdate);?> year old<td>
  </tr>

heres coding from registration3

puser_birthdate = '".$_POST['puser_birthdate']."' ,
    user_birthdate  = '".$_POST['user_birthdate']."' ,





<tr>
    <td><select name="days" id="days" class="validate[required] dobselect" >
                <option value="">Days</option>
                <?php $day=1; while($day!=32){ ?>
                <option value="<?php echo $day;?>" <?php if($_POST['days']==$day) { echo "selected"; } ?>><?php echo $day;?></option>
                <?php $day++; } ?>
              </select> <select name="months" id="months" class="validate[required] dobselect" >
                <option value="">Months</option>
                <?php $month=1; while($month!=13){ ?>
                <option value="<?php echo $month;?>" <?php if($_POST['months']==$month) { echo "selected"; } ?> ><?php echo $month;?></option>
                <?php $month++; } ?>
              </select> <select name="years" id="years" class="validate[required] dobselect" >
                <option value="">Years</option>
                <?php $year=1915; while($year!=1998){ ?>
                <option value="<?php echo $year;?>" <?php if($_POST['years']==$year) { echo "selected"; } ?> ><?php echo $year;?></option>
                <?php $year++; } ?>
              </select></td>
    <td><select name="pdays" id="pdays" class="validate[required] dobselect" >
                <option value="">Days</option>
                <?php $day=1; while($day!=32){ ?>
                <option value="<?php echo $day;?>" <?php if($_POST['pdays']==$day) { echo "selected"; } ?>><?php echo $day;?></option>
                <?php $day++; } ?>
              </select> <select name="pmonths" id="pmonths" class="validate[required] dobselect" >
                <option value="">Months</option>
                <?php $month=1; while($month!=13){ ?>
                <option value="<?php echo $month;?>" <?php if($_POST['pmonths']==$month) { echo "selected"; } ?> ><?php echo $month;?></option>
                <?php $month++; } ?>
              </select> <select name="pyears" id="pyears" class="validate[required] dobselect" >
                <option value="">Years</option>
                <?php $year=1915; while($year!=1998){ ?>
                <option value="<?php echo $year;?>" <?php if($_POST['pyears']==$year) { echo "selected"; } ?> ><?php echo $year;?></option>
                <?php $year++; } ?>
              </select></td>
</tr>

and heres database code for those 2 bits

`puser_birthdate` varchar(50) NOT NULL,
  `user_birthdate` varchar(50) NOT NULL,

Recommended Answers

All 5 Replies

Member Avatar for diafol

What a palaver. Why aren't you using a datepicker? That is just ridiculously complicated without having to be. You could replace the above with just:

<input name="user" type="date" />
<input name="puser" type="date" />

its what came with the script but ill look at thats hun

Member Avatar for diafol

Pick another script as that is woeful.

What diafol said. Mixing html and php like that is just asking for trouble. First, build up your output html in php classes and variables. Then when you are ready, output the data. You can take the data/age input from another page, and call this one with the data you need for display and other purposes. This may help: https://www.daniweb.com/web-development/php/tutorials/484310/why-you-dont-want-to-mix-php-and-html-directly-

sorted that now hun ty x

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.