Skip to content

Strange value for date

edited February 2013 in Questions

Hi Ben
Need you help and awesome coding skills again
Went to implement the auto date that you explained so well in a previous post.

Signup api page code

<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=utf-8">
<title>API Signup</title>
</head>
<body>
<img style="width: 728px; height: 90px;" alt="banner"
src="banner-signup.png"><br>
<form action="subscribe.php" method="post"
accept-charset="utf-8">
<br>
This will Subscribe you to the API test List<br>
<br>
<label for="name">Name</label>
<input name="name" type="text"><br>
<label for="email">Email</label>
<input name="email" type="text"><br>
<label for="Test">Test</label>
<input name="Test" type="text"><br>
<br>
<input name="Date" id="Date"
value="<?php echo strftime('%b %d, %G', time());?>"
type="hidden">
<input name="Subscribe" type="submit"></form>
</body>
</html>

code in the subscribe.php file

//POST variables
    $name = $_POST['name'];
    $email = $_POST['email'];
      $Test = $_POST['Test'];
      $Date = $_POST['Date'];

    $boolean = 'true';
    
    //Check fields
    if($name=='' || $email=='' || $Test=='')
    {
        echo 'Please fill in all fields.';
        exit;
    }
    
    //Subscribe
    $postdata = http_build_query(
        array(
        'name' => $name,
        'email' => $email,
        'list' => $list,
          'Test' => $Test,
          'Date' => $Date,
        'boolean' => 'true'
        )
    );
    $opts = array('http' => array('method'  => 'POST', 'header'  => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
    $context  = stream_context_create($opts);
    $result = file_get_contents($your_installation_url.'/subscribe', false, $context);
    
    //check result and redirect
    if($result)
        header("Location: $success_url");
    else
        header("Location: $fail_url");
?>

Sendy is installed on Hostmonster server

When I export the cvs for the list it gives
test-b testb@test.com vanilla Dec 31 1969

Did I screw up the code, or is the server date wrong, why didn't I get Feb 16 2013
Thanks
Craig

Comments

This discussion has been closed.