PDA

View Full Version : I need some help with my account.register.php


Fronix
02-29-2008, 06:39 PM
Ok the problem is not so easy to explain on the title sorry but i have 1 enoying problem. Ive made this site with my friend but he made the account.register and stuff and now he is out of town and i need to fix 1 thing. When you register you fill in all your info Name Lastname ect but when you come to fill in your birhdate you are requierd to write Example: 05/01/84 u have to have the / you can't write 1984 05 01 that doesnt work. How can i take away that cause its REALY enoying most ppl don't understand that they have to write that plz help.

davidj
02-29-2008, 06:45 PM
whats it written in

Fronix
02-29-2008, 06:46 PM
The whole website is written in HTML and PHP i can sen you the code if you wanna take a look?

davidj
02-29-2008, 06:48 PM
of course it is

i didnt see the title of the post

so your not happy about entering the date in backwards yes and you want to change it to the proper way

Fronix
02-29-2008, 06:51 PM
Ok the code was to long so i uploaded it download it here (http://filebeam.com/464f863aa8859bd0a2d9cde106cc084e)

Fronix
02-29-2008, 06:53 PM
No i don't want to write / between the numbers i want everyone to write there birthdate as they like but they still need to write it

davidj
02-29-2008, 06:54 PM
so you want the people to write a date without using / delimiter

Fronix
02-29-2008, 06:56 PM
Yes can you help me?

davidj
02-29-2008, 07:09 PM
yes

i would like to give someone else a go first

Fronix
02-29-2008, 07:09 PM
Ok no problem

Fronix
02-29-2008, 07:20 PM
And i have another problem sometimes when i login i dont get Ridirected to the mainpage i get ridirected to a blank page and ive checked the code and there is nothing wrong.

moe122
03-02-2008, 03:42 PM
hi,

i wouldnt call myself an expert but your date problem why dont you have 3 separate field so the user doesnt have to even care about the '/' how about 3 drop down menus 1st 1 with the day so it gives option frm 1to31 and then month and then year.........

nanny
03-07-2008, 11:09 PM
I have got this form for birthdate that may start you in the right direction:

<form name="dateofbirth" action="">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="3" class="smalltext" width="101">Birthdate (Optional) </td>
</tr>
<tr>
<td class="smalltext" width="101">Day</td>
<td class="smalltext" width="97">Month</td>
<td class="smalltext" width="38">YYYY</td>
</tr>
<tr>
<td width="101"><select id="day" name="day">
<option value="" selected>select one</option>
<?php
for($i=1;$i<32;$i++){
echo "<option value=\"$i\">$i</option><br>";
}
?>
</select>
</td>
<td width="97"><select id="month" name="month">
<option value="" selected>select one</option>
<?php
for($i=1;$i<13;$i++){
echo "<option value=\"$i\">$i</option><br>";
}
?>
</select>
</td>
<td width="38"><select id="year" name="year">
<option value="" selected>select one</option>
<?php
for($i=1901;$i<2002;$i++){
echo "<option value=\"$i\">$i</option><br>";
}
?>
</select>
</td>
</tr>
</table>
</form>



But I was given a great date function from davidj:

function dateFormater($date){

// split date into components and strip delimiter "/ -"

$yy = substr($date, 6, 4);

// detect if $yy contains just numbers
if(is_numeric($yy)){

$dd = substr($date, 0, 2);
$mm = substr($date, 3, 2);

// build mysql format
$newDate = $yy."-".$mm."-".$dd;
return $newDate;

}else{

$dd = substr($date, 8, 2);
$mm = substr($date, 5, 2);
$yy = substr($date, 0, 4);

$newDate = $dd."-".$mm."-".$yy;
return $newDate;

}


}

ok thats your function

to call it just include the file then after do this...

// this will display the date correctly after you pull it out of the db echo dateFormater($date);

// this will switch a date and prepare it for db format befor you insert it dateFormater($_POST['datefield']);

This is an extracted from this forum that davidj repied to me.