Jump to content

fix variable


dadamssg

Recommended Posts

can somebody make this work? its sayin i have an unexpected "." somewhere....i want it to output this for example Jan-12-2009 5:25 pm or Jan/12/2009...either/or, thanks

 

$begin = $_POST['smonth']."-".$_POST['sday']."-".$_POST['syear']. .$_POST['shour'].":".$_POST['sminute'].":00".$_POST['sampm'];

Link to comment
https://forums.phpfreaks.com/topic/141428-fix-variable/
Share on other sites

thanks it worked! but how do i add 10 to the $_POST['shour'] variable and update it. i have drop down for AM PM, and i want to add 10 so i can enter it enter DATETIME correctly

 

this is what i got...no good though

 

if($_POST['sampm'] = 'pm')
   {
     $_POST['shour'] = $_POST['shour'] + 10
   }

Link to comment
https://forums.phpfreaks.com/topic/141428-fix-variable/#findComment-740320
Share on other sites

thanks it worked! but how do i add 10 to the $_POST['shour'] variable and update it. i have drop down for AM PM, and i want to add 10 so i can enter it enter DATETIME correctly

 

this is what i got...no good though

 

if($_POST['sampm'] = 'pm')
   {
     $_POST['shour'] = $_POST['shour'] + 12
   }

 

<?php

if($_POST['sampm'] = 'pm')
{
    $shour = $_POST['shour'] + 10;
}

?>

 

You cant modify a $_POST variable like that

Link to comment
https://forums.phpfreaks.com/topic/141428-fix-variable/#findComment-740326
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.