Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP form mail WILL NOT WORK!
Old 09-30-2008, 02:07 AM PHP form mail WILL NOT WORK!
Experienced Talker

Posts: 48
Name: Craig
Trades: 0
Hi everyone,

I am at my wits end with this. I am trying to set up a where my employees can simply fill out a form and have their time card fixes emailed to me instead of having a bunch of scraps of paper floating around my desk. Here is the code I have for the php:

PHP Code:
<?php
if(isset($_POST['submit'])) {

$to "fake@email";
$subject "Attendance Correction Form";
$name_field $_POST['name'];
$todays_date $_POST['tDate'];
$date_correction $_POST['datecorrection'];
$time_in $_POST['timein'];
$lunch_out $_POST['lunchout'];
$lunch_in $_POST['lunchin'];
$time_out $_POST['timeout'];
 
$body "From: $name_field\n Today's Date: $todays_date\n Date Needing Correction: $date_correction\n Time In: $time_in\n Lunch Out: $lunch_out\n Lunch In: $lunch_in\n Time Out: $time_out";
 
echo 
"Thank you. Your form has been submitted.";
mail($to$subject$body);

} else {

echo 
"ERROR!";

}
?>
and the html:

HTML Code:
<form method="POST" action="acf.php">

    <p>Name<br /> 
      <input type="text" name="name" id="name" class="style"/>
      <br />
      <br /> 
    Today's Date<br /> 
    <input type="text" name="tDate" id="tDate" class="style" />
    <br /> 
    <br />
    Date Needing Correction<br /> 
    <input type="text" name="datecorrection" id="datecorrection" class="style"/>
    <br /> 
    <br />
    Time In<br /> 
    <input type="text" name="timein" id="timein" class="style"/>
    <br /> 
    <br />
    Lunch Out<br /> 
    <input type="text" name="lunchout" id="lunchout" class="style"/>
    <br /> 
    <br />
    Lunch In<br /> 
    <input type="text" name="lunchin" id="lunchin" class="style"/>
    <br /> 
    <br />
    Time Out<br /> 
    <input type="text" name="timeout" id="timeout" class="style"/>
    </p>
    <p>
      <input type="submit" name="button" id="button" value="Submit" />
        </p>
</form>
When I hit the submit button, I don't get any error messages from the script, just the "ERROR!"

Please help! Thank you ahead of time.

Last edited by werm82; 09-30-2008 at 07:39 PM..
werm82 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-30-2008, 02:45 AM Re: PHP form mail WILL NOT WORK!
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
Your conditional statement requiring the $_POST['submit'] variable to be set will never be met as you don't have one coming from the form.

Try changing name="button" on your submit button to
name="submit".
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 09-30-2008, 03:04 AM Re: PHP form mail WILL NOT WORK!
Experienced Talker

Posts: 48
Name: Craig
Trades: 0
You, my friend, are awesome. I've been struggling with this for a week. And the only thing I didn't check... Thank you so much!
werm82 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP form mail WILL NOT WORK!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23969 seconds with 12 queries