PDA

View Full Version : form results problem


up4dw
10-17-2008, 04:41 AM
I have made a form and pointed it to a script. Problem is insted of running the script it opens the scrip in the browser.

can somone help me?

http://www.hardydiesel.com/form-test.html




<?php
//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'Results from Quick Info';
// Your email address. This is where the form information will be sent.
$emailadd = 'loren.day@hardydiesel.com';
// Where to redirect after form is processed.
$url = 'www.hardydiesel.com';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

edbr
10-17-2008, 04:46 AM
you page has

&lt;?php should be <? php
?&gt; should be ?>
if you copy paste , paste into the code, not the design view

up4dw
10-17-2008, 06:14 AM
edbr

I think I am blind I dont see &lt;?php or ?&gt;

you page has

&lt;?php should be <? php
?&gt; should be ?>
if you copy paste , paste into the code, not the design view

edbr
10-17-2008, 06:16 AM
look at the page source in a browser or code view in dreamweaver

davidj
10-17-2008, 06:21 AM
its in your formresults.php page