PHP varaible question

thenewprogrammer

New Member
Messages
45
Reaction score
0
Points
0
Having problems trying to get 3 differnt values into one field(birthday,birthmonth,birthyear)

found out i cant assign more than one value to variable like this
and wondering if and how i can set this into array. this outputs nothing and when i give them differnt varables and try to put it into same field only the first one shows.

Code:
$birthday=strip_tags($_POST['birthday']);
           $birthday=strip_tags($_POST['birthmonth']);
           $birthday=strip_tags($_POST['birthyear']);
 
$sql="INSERT INTO temp SET code='$confirm_code',user_name='$name',user_email='$email',user_password='$pass', user_gender='$gender',user_birthday='$birthday'";
    $result=mysql_query($sql);
 
Last edited:

lmstfy

New Member
Messages
18
Reaction score
0
Points
0
Code:
$birthday = strip_tags($_POST['birthday']) . strip_tags($_POST['birthmonth']) . strip_tags($_POST['birthyear']);
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
1. Am I right in assuming user_birthday is text and not a Date field?

2. Are the fields from the form all numerals? In that case, you might want to put a space or slash between them when you combine them using lmstfy's code. Otherwise 1111988 can be formed by 1 11 1988 or by 11 1 1988. If you are using zero padded days/months, then you don't have to. Also, if you are using the month spelled out, it is not necessary.
 
Top