Jump to content

if else in php


stockdalep

Recommended Posts

I have this small piece of code inside a form it works fine in IE6 but inside Mozzila Firefox sameday and tuesday seem to become one. Example if I select tuesay sameday gets selected.

 

Thanks for any ideas/help

 

Form Address

 

www.linfordfc.com/delivery_pickup_form.php

 

<?php $timenow=date("Hi");

if($timenow < 1200)

{

?>

<input type="radio" name="delivery_day" value="sameday" />

<?php echo("Same Day");

     

}

 

?>

      <input type="radio" name="delivery_day" value="tuesday" />     

<?php echo date('l jS F Y', strtotime('+2 days'))?></label>

      <label>

 

 

      <input type="radio" name="delivery_day" value="wednesday" />

<?php echo date('l jS F Y', strtotime('+3 days'))?></label>

      <label></label>

      </span></strong></div></td>

    </tr>

    <tr>

      <td><div align="center"><span class="style27"><strong><span class="style2">

        <label>

        <input type="radio" name="delivery_day" value="thursday" />

        <?php echo date('l jS F Y', strtotime('+4 days'))?></label>

        <label>

        <input type="radio" name="delivery_day" value="friday" />

        <?php echo date('l jS F Y', strtotime('+5 days'))?></label>

        <label>

        <input type="radio" name="delivery_day" value="saturday" />

        <?php echo date('l jS F Y', strtotime('+6 days'))?></label>

      </span></strong></span></div></td>

    </tr>

    <tr>

      <td bgcolor="#FFFFFF"> </td>

    </tr>

Link to comment
https://forums.phpfreaks.com/topic/46112-if-else-in-php/
Share on other sites

Well, I can fix your label's at least:

 

<?php
$timenow=date("Hi");
if($timenow < 1200) {
?>

<input type="radio" name="delivery_day" value="sameday" /><label>

<?php
echo("Same Day");      
}
?>

</label><input type="radio" name="delivery_day" value="tuesday" /><label>       

<?php
echo date('l jS F Y', strtotime('+2 days'))
?>

</label><input type="radio" name="delivery_day" value="wednesday" /><label>

<?php
echo date('l jS F Y', strtotime('+3 days'))
?>

</label>
</span></strong></div></td>
</tr>
<tr>
<td><div align="center"><span class="style27"><strong><span class="style2">
<input type="radio" name="delivery_day" value="thursday" /><label>

<?php
echo date('l jS F Y', strtotime('+4 days'))
?>

</label><input type="radio" name="delivery_day" value="friday" /><label>

<?php
echo date('l jS F Y', strtotime('+5 days'))
?>

</label><input type="radio" name="delivery_day" value="saturday" /><label>

<?php
echo date('l jS F Y', strtotime('+6 days'))
?>

</label></span></strong></span></div></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
</tr>

 

That should do it, I hope, you only posted a little bit of your code.  Oh, and in the future, please post code inside [ code] [ /code] tags.

Link to comment
https://forums.phpfreaks.com/topic/46112-if-else-in-php/#findComment-224070
Share on other sites

I remember the old school inputs. What you need is javascript to de-select one if another is checked.

 

I have not seen this issue for a really long time, but I do not know it was a problem with all browsers and the only to un-select one radio was once one was clicked JS goes in and de-selects the others. But that was a long time and I have yet to see that problem re-occur. I could be mis-lead.

Link to comment
https://forums.phpfreaks.com/topic/46112-if-else-in-php/#findComment-224230
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.