Forums

PHP

This topic is locked

PHP Please help

Posted 02 Jul 2008 02:46:25
1
has voted
02 Jul 2008 02:46:25 Debbie Durham posted:
I am new to PHP and just want a form mailed to me after its been completed. I followed thesitewizards tutorial but I am still stuck because my form does not get sent to me. Below is the code I am using to test it and it does not work ... I only placed a few fields in the mail part of the script to see if it would work....

I know there is a lot more scripting to do... validation.. etc... but this should work right?

here is my code:

<?php
$company = $_REQUEST['company'] ;
$first_name = $_REQUEST['first_name'] ;
$last_name = $_REQUEST['last_name'] ;
$address = $_REQUEST['address'] ;
$city = $_REQUEST['city'] ;
$state = $_REQUEST['state'] ;
$zip = $_REQUEST['zip'] ;
$phone_1 = $_REQUEST['phone_1'] ;
$email = $_REQUEST['email'] ;
$manufacturer = $_REQUEST['manufacturer'] ;
$model = $_REQUEST['model'] ;
$year = $_REQUEST['year'] ;
$hours = $_REQUEST['hours'] ;
$motor_make = $_REQUEST['hp'] ;
$cylinders = $_REQUEST['cylinders'] ;
$motor_condition = $_REQUEST['motor_condition'] ;
$trans_type = $_REQUEST['trans_type'] ;
$speeds = $_REQUEST['speeds'] ;
$trans_condition = $_REQUEST['trans_condition'] ;
$final_drive = $_REQUEST['final_drive'] ;
$hydraulics = $_REQUEST['hydraulics'] ;
$linkages = $_REQUEST['linkages'] ;
$under_carriage = $_REQUEST['under_carriage'] ;
$pins_bushings = $_REQUEST['pins_bushings'] ;
$sprockets = $_REQUEST['sprockets'] ;
$rails = $_REQUEST['rails'] ;
$tracks = $_REQUEST['tracks'] ;
$front_tires = $_REQUEST['front_tires'] ;
$rear_tires = $_REQUEST['rear_tires'] ;
$cab_type = $_REQUEST['cab_type'] ;
$cab_ext_cond = $_REQUEST['cab_ext_cond'] ;
$cab_int_cond = $_REQUEST['cab_int_cond'] ;
$glass_cond = $_REQUEST['glass_cond'] ;
$sheet_metal = $_REQUEST['sheet_metal'] ;
$paint_cosmetics = $_REQUEST['paint_cosmetics'] ;
$other_notes = $_REQUEST['other_notes'] ;
$asking_price = $_REQUEST['asking_price'] ;

mail( " ", "Form Listing",
"$company", "First Name: $first_name", "Last Name: $Last_name", "From: $email" ) ;





Edited by - felinawi on 02 Jul 2008 05:28:04

Replies

Replied 02 Jul 2008 10:22:35
02 Jul 2008 10:22:35 Alan C replied:
Hi
have a look at formstogo, a shareware application that does good things with forms etc, there is pc and mac versions.

Here is some code that I have copied from one of my working scripts . . .

<pre id=code><font face=courier size=2 id=code> $emailTo="Tester &lt; &gt;";

$emailFrom = FilterCChars(" ";

$emailHeader = "From: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: 8bit\n";

mail($emailTo, $emailSubject, $emailBody, $emailHeader);
</font id=code></pre id=code>

you'll need to set up the subject and emailbody variables with what you want to send,

A lot of my forms are getting spammed with junk so I am incorporating a CAPTCHA into them, it's a lot easier to do it at the start rather than having to go back and do it later. Another thing - I just wasted a whole day because my hosting company has turned off sessions, so I found that when I came to add the captcha nothing was getting passed from page to page, I had to diagnose it in minute detail as it was working on all my other sites, eventually I found the problem, now I know I can at least ask support to turn it on

Alan C

Reply to this topic