smti Posted April 5, 2008 Share Posted April 5, 2008 Hello, I am trying to put 3 strings together separated by slashes. (It's a date field), but when I output the end result I see something like this: 01/200725/2007 Does anyone know why? Here is my code: //Grab Separate Date Values for Admission Date $doamonth=$_REQUEST['doamonth']; $doaday=$_REQUEST['doaday']; $doayear=$_REQUEST['doayear']; //Put date values together $slash='/'; $doa=$doamonth .=$slash .=$doaday .= $slash .=$doayear; echo $doa; The result is something like this: 01/200725/2007 if I input the date as such: 01/25/2007 (using month/day/year format.) Thanks for your help! - smti Link to comment https://forums.phpfreaks.com/topic/99705-concatenation-problem/ Share on other sites More sharing options...
kenrbnsn Posted April 5, 2008 Share Posted April 5, 2008 You're syntax is all wrong. Do: <?php //Grab Separate Date Values for Admission Date $doamonth=$_REQUEST['doamonth']; $doaday=$_REQUEST['doaday']; $doayear=$_REQUEST['doayear']; //Put date values together $doa=$doamonth . '/' . $doaday . '/' . $doayear; echo $doa; ?> or <?php //Grab Separate Date Values for Admission Date $doamonth=$_REQUEST['doamonth']; $doaday=$_REQUEST['doaday']; $doayear=$_REQUEST['doayear']; //Put date values together $doa="$doamonth/$doaday/$doayear"; echo $doa; ?> Ken Link to comment https://forums.phpfreaks.com/topic/99705-concatenation-problem/#findComment-510052 Share on other sites More sharing options...
bsamson Posted April 5, 2008 Share Posted April 5, 2008 Try: <?php //Put date values together $slash='/'; $doa=$doamonth.$slash.$doaday.$slash.$doayear; echo $doa; ?> Link to comment https://forums.phpfreaks.com/topic/99705-concatenation-problem/#findComment-510053 Share on other sites More sharing options...
smti Posted April 5, 2008 Author Share Posted April 5, 2008 Thanks guys, I figured it was something dumb. -smti Link to comment https://forums.phpfreaks.com/topic/99705-concatenation-problem/#findComment-510056 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.