Jump to content

Recommended Posts

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\">";
}
?>
Link to comment
https://forums.phpfreaks.com/topic/9648-simple-error-i-cant-fix-though/
Share on other sites

hi

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

[code]
<?php
php info();
?>
[/code]

([b]nb[/b]: 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 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--]
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--]
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
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:
[code]#!user/cgi-bin/php[/code]
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.
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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.