Jump to content


Photo

Simple error- i cant fix though


  • Please log in to reply
10 replies to this topic

#1 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 14 May 2006 - 11:17 AM

I have my contact forms and driver profile submit forms on my website but whenever a user or myself tries to use them they ask what to do with the php script eg save or open. why is this happening.

this can be found at [a href=\"http://media.mackaykarting.com/Profiles/\" target=\"_blank\"]http://media.mackaykarting.com/Profiles/[/a]


P.S. i am new to php and dont really know much about this

the code i have is
<?php
// Website Contact Form Generator
// [a href=\"http://www.tele-pro.co.uk/scripts/contact_form/\" target=\"_blank\"]http://www.tele-pro.co.uk/scripts/contact_form/[/a]
// 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 = "adam@mackaykarting.com";
$Subject = "Driver_profile";
$Name = Trim(stripslashes($_POST['Name']));
$classes_raced = Trim(stripslashes($_POST['classes_raced']));
$Age = Trim(stripslashes($_POST['Age']));
$Make_of_kart = Trim(stripslashes($_POST['Make_of_kart']));
$racing_number = Trim(stripslashes($_POST['racing_number']));
$Most_respected_competitor = Trim(stripslashes($_POST['Most_respected_competitor']));
$career_highlights = Trim(stripslashes($_POST['career_highlights']));
$driving_ambitions = Trim(stripslashes($_POST['driving_ambitions']));
$how_long_karting = Trim(stripslashes($_POST['how_long_karting']));
$other_comments = Trim(stripslashes($_POST['other_comments']));
$agree = Trim(stripslashes($_POST['agree']));

// 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 .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "classes_raced: ";
$Body .= $classes_raced;
$Body .= "\n";
$Body .= "Age: ";
$Body .= $Age;
$Body .= "\n";
$Body .= "Make_of_kart: ";
$Body .= $Make_of_kart;
$Body .= "\n";
$Body .= "racing_number: ";
$Body .= $racing_number;
$Body .= "\n";
$Body .= "Most_respected_competitor: ";
$Body .= $Most_respected_competitor;
$Body .= "\n";
$Body .= "career_highlights: ";
$Body .= $career_highlights;
$Body .= "\n";
$Body .= "driving_ambitions: ";
$Body .= $driving_ambitions;
$Body .= "\n";
$Body .= "how_long_karting: ";
$Body .= $how_long_karting;
$Body .= "\n";
$Body .= "other_comments: ";
$Body .= $other_comments;
$Body .= "\n";
$Body .= "agree: ";
$Body .= $agree;
$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\">";
}
?>

#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 14 May 2006 - 11:41 AM

hi

you either don't have php installed on your server or it is installed incorrectly. try out this:

<?php
php info();
?>

(nb: take the space out of php and info in the code above so that it's one word - phpfreaks forum wouldnt let me post it as it was sposed to be)

if it works, i was wrong. if it doesnt, then you need to install php correctly.

cheers
Mark
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#3 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 15 May 2006 - 07:00 AM

I have done this but am not sure what is supposed to happen

#4 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 15 May 2006 - 07:21 AM

You should see a page that displays all the info about your php installation. Version, modules, etc.

If it didn't work, you will see the code of your actual php file.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#5 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 15 May 2006 - 07:36 AM

i dont see the code or any thing else you can see for yourself at [a href=\"http://media.mackaykarting.com/test.htm\" target=\"_blank\"]http://media.mackaykarting.com/test.htm[/a]


#6 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 15 May 2006 - 07:48 AM

If you need to use php in ANY file, it must be named .php. Not .htm or .html.

Change the filename to .php

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#7 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 15 May 2006 - 07:50 AM

yes how clumsy of me

now thats back to basics

now back to the saving thing

[a href=\"http://media.mackaykarting.com/Profiles/test.php\" target=\"_blank\"]http://media.mackaykarting.com/Profiles/test.php[/a]

#8 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 15 May 2006 - 07:54 AM

It is trying to make me download the php file which tells me that PHP is NOT installed on the server. You need to check with your hosting company. It looks like you're gonna need a different hosting package. One that has php installed.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#9 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 15 May 2006 - 07:58 AM

but i do have php installed by them, allthough google is apparently using my bandwidth but they wont give me a proper report so i can show google and make them stop so i am going way over my 2gb limit by almost triple

but thanks for the help you guys are great

#10 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 15 May 2006 - 09:13 AM

I think your hosting company may have a special setup of PHP which might require a special line called a shebang line, I think thats what it is called, it goes something like this:
#!user/cgi-bin/php
That goes right at the top of your PHP file. However I would check with your webhost how to execute and where to store your PHP scripts, also you might want to ask whether they have configured the server to parse .php files with the PHP Interpreter correctly.

#11 mrkarter77

mrkarter77
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 16 May 2006 - 09:01 AM

This form has worked before yet it is only recently sincs i have been getting the google bots crawling my site and using 5gb of bandwidth in the first day of the month and me having no bandwidth left that i have been getting this

would that have anything to do with it




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users