stublackett Posted October 27, 2008 Share Posted October 27, 2008 Hi, Hopefully a quick one for someone, Think I'm partially there I'm looking to get the three variables arrival-date,arrival-month and arrival-year into 1 variable for a contact message to be sent to the site owner How do I get the Variables into 1 array to output just the 1 variable titled "Arrival Time" ? My code currently looks like this ..... <?php $arrivaldate = array($_POST['arrival-date'],$_POST['arrival-month'],$_POST['arrival-year']); ?> and at the moment the E-Mail that is sent just has "Array" in it ??? Link to comment https://forums.phpfreaks.com/topic/130275-solved-3-variables-into-1-array/ Share on other sites More sharing options...
The Little Guy Posted October 27, 2008 Share Posted October 27, 2008 $arrivaldate = array($_POST['arrival-date'],$_POST['arrival-month'],$_POST['arrival-year']); echo $arivaldate[0].'<br />'; echo $arivaldate[1].'<br />'; echo $arivaldate[2]; Link to comment https://forums.phpfreaks.com/topic/130275-solved-3-variables-into-1-array/#findComment-675585 Share on other sites More sharing options...
stublackett Posted October 27, 2008 Author Share Posted October 27, 2008 Excellent, Thanks for that Link to comment https://forums.phpfreaks.com/topic/130275-solved-3-variables-into-1-array/#findComment-675592 Share on other sites More sharing options...
kenrbnsn Posted October 27, 2008 Share Posted October 27, 2008 You can also use the print_r() function: <?php echo print_r($arrivaldate,true); ?> or a foreach() <?php foreach($arrivaldate as $v) echo $v ."<br>\n"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/130275-solved-3-variables-into-1-array/#findComment-675593 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.