Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
<?php
$datetime=date("d-m-y");
$date1=date("d")+1;
$datetime1=date("$date1-m-y ");
$date1=$date1+1;
$datetime2=date("$date1-m-y ");
$date1=$date1+1;
$datetime3=date("$date1-m-y ");
echo $_POST['date1'];
echo $datetime1;
if($_POST['date1']==$datetime1)
{
header("location:bus2.php");
}
?>
here if condition doesn't work even though echo $_POST['date1']; and echo $datetime1; shows the same result.
The values are NOT the same:
$datetime1=date("$date1-m-y ");
^--this space makes all the difference:
$_POST['date1'] = '14-02-2014';
$datetime1 = '14-02-2014 ';
^--- spot the difference
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I would like to print all the months inside a select tag. Can you point out where I went wrong
<select>
<?php
$array=array("January","February","March","April","May","June","July","August","September","October","November","December");
for($i=$array[0];$i<=$array[11];$i++)
{
echo "<option>$i</option>";
}
?>
</select>
Your loop should be
for ($i=0; $i < count($array); $i++)
{
echo "<option>$array[$i]</option>";
}
You can use below code too. I have modified your code.
<?php
$array=array("January","February","March","April","May","June","July","August","September","October","November","December");
echo '<select>';
foreach($array as $month){
echo "<option>".$month."</option>";
}
echo '</select>';
?>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
i just need on small info i want just add '#' to one variable and and put add thing into one variable. i am adding small php code to here please suggest me.
<?php
$email34 = $row['email'];
$rem = '#gmail.com';
$trim_email = str_replace($rem ,'', $email34);
$tag_name ="#".$trim_emial.;
echo $tag_name;
?>
but i am getting only # as output;
but my out should be "#mahesh1" if any have idea about this code please help me. thank you advanced.
there is so much spelling mistakes in the variables... try below given code
<?php $email34 = $row['email'];
$rem = '#gmail.com';
$trim_email = str_replace($rem ,'', $email34);
$tag_name ="#".$trim_email;
echo $tag_name;
?>
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
I can not color the $_SESSION['username'] while echo in php.
echo "Welcome, " .$_SESSION['username']."! "; //this code is running
echo '<span style="color:#AFA;text-align:center;">Welcome,'$_SESSION['username'];'</span>'; // this part is not working...
Please help me if you can
You forgot the concatenation ..
echo '<span style="color:#AFA;text-align:center;">Welcome,' . $_SESSION['username'] . '</span>'; // this part is not working...
Notice the missing . before and after $_SESSION['username'];
echo'<span style="color:#AFA;text-align:center;">Welcome,'.$_SESSION['username'].'</span>';
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Okay this really strange or I am missing something. When I run this very simmple PHP script on cmd I get the expected output which is 0. but when I uncomment the last two lines of code. . .nothing is displayed.
<?php
$test1 = 0;
echo $test1;
$test2 = 0;
#$test1_weight = 0:
#$test2_weight = 0;
?>
Is there some rule against declaring variables after an echo statement?
$test1_weight = 0:
--> change ":" to ";"
No there is no rule against declaring variables after an echo statement
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am validating a condition for
$time = $user['time_send'];
$chk_date = date('Y-m-d H:i');
var_dump($time == $chk_date);
But I am getting bool(false) as output.
$time = '2014-03-7 15:14';
$chk_date = '2014-03-07 15:14';
if(strtotime($time) == strtotime($chk_date)){
echo 'hola';
}else{
echo 'hello';
}