Jump to content

How to change todayis [EST] time on php form


route609

Recommended Posts

Hello

 

This is my very first post as i am just begining to learn php.

 

I have created/copied a contact form and implemented it into my website. Everything works fine apart from one thing, when i recieve the email from the contact form the time on the email is 5hours faster than the time the email was sent. The code i have is this:

 

$message = " $todayis [EST] \n

Attention: $attn \n

Message: $notes \n

From: $visitor ($visitormail)\n

";

 

How do i set the time/date to make sure the correct time and date show on the email from when the contact form was sent?

 

Thank you  :)

Link to comment
Share on other sites

if your inserting the info in to a db as well just use the NOW() function, if not i cant help you sorry :(

 

Hi

 

I dont think i am instering into a database. Liek i said i took the form from the net and modifed parts, so all i have is the sendemail.php and contact.php. Thanks anyway, :)

Link to comment
Share on other sites

You would need to post your code that is getting and placing the time into the message to get the quickest solution.

 

If you are using the date() function, then use the date_default_timezone_set() function (php5) to set the time zone that the code uses.

 

Thank you, thats great, How do i do it? I am totally new to PHP. would i change the

$message = " $todayis [EST] \n

Attention: $attn \n

Message: $notes \n

From: $visitor ($visitormail)\n

"; 

 

script? If so what would i put instead :)

Link to comment
Share on other sites

please post all your code for the three files.

 

Hi

 

sendemail.php file source:

<?php

 

$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$visitor = $_POST['visitor'];

$visitormail = $_POST['visitormail'];

$notes = $_POST['notes'];

$attn = $_POST['attn'];

 

 

if (eregi('http:', $notes)) {

die ("Do NOT try that! ! ");

}

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))

{

echo "<h2>Use Back - paulwallas@souladesign.com</h2>\n";

$badinput = "<h2>Feedback was NOT submitted</h2>\n";

echo $badinput;

die ("Go back! ! ");

}

 

if(empty($visitor) || empty($visitormail) || empty($notes )) {

echo "Not all fields have been completed correctly<br />\n";

die ("Please use the back button at the top of the browser");

}

 

$todayis = date("l, F j, Y, g:i a") ;

 

$attn = $attn ;

$subject = $attn;

 

$notes = stripcslashes($notes);

 

$message = " $todayis [EST] \n

Attention: $attn \n

Message: $notes \n

From: $visitor ($visitormail)\n

";

 

$from = "From: $visitormail\r\n";

 

 

mail("paulwallas@souladesign.com", $subject, $message, $from);

 

?>

 

<p align="center">

<strong>Thank You :</strong>

<br />

<?php echo $visitor ?><br />

( <?php echo $visitormail ?> )

<br /><br />

<strong>Message:</strong>

<br />

<?php $notesout = str_replace("\r", "<br/>", $notes);

echo $notesout; ?> 

 

 

Contact.php source code file :

  <form method="post" action="sendemail.php">

    <!-- DO NOT change ANY of the php sections -->

    <?php

$ipi = getenv("REMOTE_ADDR");

$httprefi = getenv ("HTTP_REFERER");

$httpagenti = getenv ("HTTP_USER_AGENT");

?>

    <input type="hidden" name="ip" value="<?php echo $ipi ?>" />

    <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />

    <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

    Full Name: <br />

  <input type="text" name="visitor" size="35" id="textfield" />

  <br /><br />

    E-mail:<br />

  <input type="text" name="visitormail" size="35" id="textfield2" />

  <br />

  <br />

  Attention:<br />

<select name="attn" size="1" id="textfield3">

<option value=" Partners ">Partners </option>

<option value=" Projects ">Projects </option>

<option value=" Proposal ">Proposal </option>

<option value=" Other ">Other </option>

</select><br  /><br  />

    Query: <br />

  <textarea name="notes" rows="4" cols="40" id="textarea"></textarea>

  <br /><br />

  <input type="submit" value="Submit" id="button" />

  </form>

 

These are the only two files i have for this, Thank you !

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.