Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Reply to this topicStart new topic
> Trouble With Form Script, Please help
wild20
post May 11 2006, 04:10 PM
Post #1


Never alone with Christ
*********

Group: Members
Posts: 647
Joined: 22-July 05
Member No.: 9,713



Hey I am setting up a form for my site, http://inneed.mxweb.co.uk/contact/index.html That is where the form is located. But guess what? It doesn't work. I used a free form generator. And it made me this code:

CODE

<?php
// Website Contact Form Generator
// http://www.tele-pro.co.uk/scripts/contact_form/
// This script is free to use as long as you  
// retain the credit link  

// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "contact@inneed.mxweb.co.uk";
$Subject = "Contact form query";
$Subject = Trim(stripslashes($_POST['Subject']));
$Name = Trim(stripslashes($_POST['Name']));
$Email = Trim(stripslashes($_POST['Email']));
$Problem/Query = Trim(stripslashes($_POST['Problem/Query']));

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Subject: ";
$Body .= $Subject;
$Body .= "\n";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Problem/Query: ";
$Body .= $Problem/Query;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>


Anyway, so I did this, but it says that there is a parse error on line 14. Un unexpected '=' to be exact. Could someone please help me out and help me get this working? Thanks!
Go to the top of the page
 
+Quote Post
truefusion
post May 11 2006, 04:24 PM
Post #2


Ephesians 6:10-17
Group Icon

Group: [MODERATOR]
Posts: 1,898
Joined: 22-June 05
From: The World of Gentoo
Member No.: 8,528
T17 GFX Crew



I blame the forward slash. I dont think with such a thing as a variable is allowed. If removing it doesn't help, for each instance, then i'm not sure what to tell you.
Go to the top of the page
 
+Quote Post
jlhaslip
post May 11 2006, 05:01 PM
Post #3


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 4,005
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



Yes, I would rename this variable to some thing like Problem_Query to avoid using the slash which is a special character in php and I don't think variables can contain them. If you rename it in this script, be sure to alter the form, too.
Go to the top of the page
 
+Quote Post
wild20
post May 11 2006, 08:00 PM
Post #4


Never alone with Christ
*********

Group: Members
Posts: 647
Joined: 22-July 05
Member No.: 9,713



laugh.gif It says it is a = sign actually. I mean, if that shows up after I find out what that is, then I will know to fix that as well, but something on line 14 right now. Could you help with out with that first? Thanks. Anyway, I don't know what would be causing that. Actualy, is that what the = sig coulod mean? I am so confused. Could you take one more look at the code? Thanks!
Go to the top of the page
 
+Quote Post
truefusion
post May 11 2006, 08:27 PM
Post #5


Ephesians 6:10-17
Group Icon

Group: [MODERATOR]
Posts: 1,898
Joined: 22-June 05
From: The World of Gentoo
Member No.: 8,528
T17 GFX Crew



The thing about parse errors is a funny thing. Just cause it says it deals with one thing doesnt mean that it is that thing. But that's not always the case. Did you change the slash, yet, wherever it occurs? Or do you still think it has something to do with an equal sign?
Go to the top of the page
 
+Quote Post
wild20
post May 11 2006, 10:04 PM
Post #6


Never alone with Christ
*********

Group: Members
Posts: 647
Joined: 22-July 05
Member No.: 9,713



I am pretty sure it is the equals sign. Also, it says line 14, and I have used lines before. They work great to pinpoint a location, but I don't know where to count down 14 on this script. It looks like I may need to skip some stuff. Anyway, I didn't try taking those out. I will try it though and get back to you tomorrow because I can't access it right now. In the meant time, maybe you oculd look and see if there is the equals sign that is causing the pronlem? I believe that is where it is.
Go to the top of the page
 
+Quote Post
husker
post May 11 2006, 10:14 PM
Post #7


EVIL CORN!
*********

Group: Members
Posts: 623
Joined: 7-May 06
From: USA
Member No.: 23,230
Spam Patrol



It would be easier to setup a forum by using a pre-installed script such as Fantastico or another script. Those should work. What did you use to create this script with? Their site/link should have what the script should look like, and you can compare it to yours.
Go to the top of the page
 
+Quote Post
Saint_Michael
post May 12 2006, 05:52 AM
Post #8


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,466
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



Also the best advice I could give is make the form yourself go to pixel2life.com they have tutorials on about almost everything for forms like security, mysql and php.

So check them out, Cuz most of the time those form generator screw you over in terms of proper coding, the form actually being sent and all that.
Go to the top of the page
 
+Quote Post
truefusion
post May 12 2006, 07:12 AM
Post #9


Ephesians 6:10-17
Group Icon

Group: [MODERATOR]
Posts: 1,898
Joined: 22-June 05
From: The World of Gentoo
Member No.: 8,528
T17 GFX Crew



Line 14, would be this (if you counted down by what you gave us, if you start where the code start):
QUOTE
$Problem/Query = Trim(stripslashes($_POST['Problem/Query']));

And, if that's the case, it should be for certain, that the forward slash "/" is causing the problem. Because there are rules you need to follow when naming variables. And if it is the forward slash, you would also have to change line 36 - cause it has the same variable - to match the edited variable from line 14.

This post has been edited by truefusion: May 12 2006, 07:13 AM