Hello everybody, it's me again, I hope this is a quick one though
Can you echo some php tags inside another echo?
This is what is happening and I can't fix it:
I had this:
<input type="hidden" name="com_date" <?php echo "value=\'".date("Y/m/d")."\'"; ?> />
and it was getting the date correctly and I would display it then with this:
<?php $date = $line['com_date']; echo date('m-d-Y', strtotime($date)); ?>
But then I needed to display the form that gets the date under an if statement so the whole form is inside echo '//here are a lot of line of code';
and after that everything works fine still except for the line the is getting the date, it looks kinda like this (I'm excluding a lot of unnecessary code):
<?php if($_SESSION['id']){
echo '<form action="/thankyou.php" method="post" onsubmit="return formValidator()">
<input type="hidden" id="status" name="status" value="0" />
<input type="hidden" name="com_date" <?php echo "value=\'".date("Y/m/d")."\'"; ?> />
<p>Name: <input type="text" id="name" name="name" /></p>
<p>City: <input type="text" id="city" name="city" /></p>
<p>State: <input type="text" id="state" name="state" /></p>
... a lot more lines here';}
else echo '<p>Please log in to be able to post comments!</p>'; ?>
So after this my date is being stored as 0000-00-00 in the DB and displayed as 12-31-1969 on the website.
Any suggestions? Thank you all and sorry for the unusual amount of questions lately :)