View Full Version : PHP Form Script Help..
DcK Sat, April 22nd, 2006, 01:55 PM Hey bros,
Anyone out there help me get this form page to work ??
www.fordremax.com/form.htm
I've got the php script on the servor, but I don't know what to put into the html code to make the script work. I'm just trying to get this form to submit to me email addy.
Any help?
Thanks!
PS) I'm willing to paypal someone a few bucks if they can help me get it going.... peace
jk0 Sat, April 22nd, 2006, 02:33 PM You're going to want to make sure the HTML form vars match up with the vars in the PHP script, and set the <form action="" to the PHP script.
Foley Sat, April 22nd, 2006, 02:51 PM You want to include the PHP script in what you have on that form?
If so, do something like
<? include "path to script" ?>
DcK Sat, April 22nd, 2006, 03:22 PM Below is the form.php copied and pasted:
What I don't know how to do is create the HTML within the form.htm file that will make this .php script work???
<?php
$email = 'dr.fford@gmail.com'; //your email address
$subject = $_POST['_header'];
$senderemail = $_POST['Email'];
$pagename = $_POST['_pagename'];
$firstname = $_POST['FirstName'];
$lastname = $_POST['LastName'];
$daytime = $_POST['DayPhone'];
$nighttime = $_POST['EveningPhone'];
$fax = $_POST['FAX'];
$address = $_POST['Address'];
$city = $_POST['City'];
$state = $_POST['State_Province'];
$zipcode = $_POST['Zip_Postal_Code'];
$comments = $_POST['Comments'];
$report = $_POST['Report'];
$message = "
Subject: $subject\r\n
Sender: $senderemail\r\n
Page: $pagename\r\n
First Name: $firstname\r\n
Last Name: $lastname\r\n
Daytime Phone number: $daytime\r\n
Evening Phone number: $nighttime\r\n
Fax: $fax\r\n
Address: $address\r\n
City: $city\r\n
State or Province: $state\r\n
Postal Code: $zipcode\r\n
Comments: $comments\r\n
Report: $report
";
$headers =
'From: noreply@fordremax' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = stripslashes($message);
mail("$email", "$subject", "$message", "$headers");
header("Location: /index.html");
?>
DcK Sat, April 22nd, 2006, 03:24 PM If you goto www.fordremax.com/form.htm ... and VIEW script, you'll see there's NO html script to power the .php and make the form submit work??
Foley Sat, April 22nd, 2006, 03:35 PM hmmm not sure, I can have a look later, got some stuff to do at the moment. I am sure someone else can help, Im not 100% sure what you have to do to make it work.
DcK Sat, April 22nd, 2006, 03:51 PM Thanks for help Foley.
No worries if your busy.
If it helps anyone, here's a page where the above PHP script works flawlessly with the below HTML page:
http://homeford.com/27tips.html
What I can't figure out is What HTML code to PULL out of "27tips.html" to insert into my new page "form.html"
Hope that makes sense.
Foley Sat, April 22nd, 2006, 04:38 PM <input value="Submit" type="submit"> <input value="Clear Form" onclick="ResetForm();" type="button">
</td>
Maybe try that...
Have you said in the php script WHERE you want it to go?
DcK Sat, April 22nd, 2006, 04:53 PM Yea, it should go to my email addy, which is dr.fford@gmail.com .
I inserted your line and gave it a try, still didn't work. Maybe I'm putting it in the wrong place? Which line would you insert it in on the form.html html code?
Foley Sat, April 22nd, 2006, 04:54 PM Well it needs to link in to the sumbit button. You need to tell it what to do, which is to submit the form to your email.
I am sorry if I sound vague, but I am not 100% sure on forms
;)
DcK Sat, April 22nd, 2006, 05:30 PM Thanks for your help bro.
I don't know jack squat about forms.
I tried inserting your html into line 94 where the submit button is, but it didn't help. Still does same thing, when you fill it out and hit "submit".. nothing happens.
Tempered Sat, April 22nd, 2006, 06:29 PM For one thing, I don't see a form tag in your HTML. All of the input elements should be inside of the form.
Try reading about forms here (http://www.w3.org/TR/html4/interact/forms.html).
Edit: Okay, workout is done and I took another look. You need a form tag that looks something like this:
<form name="myForm" method="post" action="myPHPScript.php">
<!-- all your form input fields and buttons go inside the form tags -->
</form>
That says where the form input fields will go once they click submit. You can also use <input type="reset"> for the reset button and it will automatically reset the fields to there original values.
DcK Sat, April 22nd, 2006, 07:33 PM Yea, there's no form tag because I don't know how to do it.
Can anyone throw me up the HTML and tell me what Line to insert it at?
Sh!t, I'm willing to pay someone, I don't have time to read 5,000 pages to get a simple php script to work.
If not, no problem- thanks anyway.
Foley Sun, April 23rd, 2006, 04:51 AM It is best to read up on these things, and I shouldnt take too long because it is not that complex IMO, not that I know how to do it though ;)
Foley Sun, April 23rd, 2006, 04:52 AM http://www.w3.org/TR/html4/interact/forms.html#h-17.3
maybe that will help you...
DcK Sun, April 23rd, 2006, 12:43 PM Thanks Foley.
CHeck it out now: www.fordremax.com/form.htm
I've got it working with TWO problems:
1) After you hit submit, you'll goto a 404 error page.
2) The darn clear button doesn't work.
LOL
BUT- The script is now working, even though you see a 404 error after submitting, I still get all the info. emailed to me like I wanted.
Thoughts?
--------------------------
UPDATE:
OKAY, the clear or RESET button works now. Still got the 404 error problem after submit.
UPDATE #2:
GOT IT!! It's all working now, finally, Thank Heaven! Thanks!
Foley Sun, April 23rd, 2006, 01:12 PM When you submit, you need to tell it to open up a page, where it says something like:
"Thank you for submitting! Click here to return to the site!"
Edi: We posted at the same time! ;)
|
|