Connecting Tech Pros Worldwide Forums | Help | Site Map

Contact Form

Jason
Guest
 
Posts: n/a
#1: Jul 17 '05
My server does support php, but I cannot get contact form to work.
Could use some help to see if any error in php code and appreciate
help in advance! Jason

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<?
$name = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;

if (!isset($_REQUEST['email'])) {
header( "Location: index.htm" );
}
elseif (empty($name) || empty($email) || empty($subject) ||
empty($message)) {
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<link href="css/jace2.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p class="topic">Unable to send your message!</p>
<p>One or more fields are empty and ALL fields in contact form are
required to be filled to be able to send your message </p>
<p> Click your browser's &quot;back&quot; button to return to the
contact form and fill all fields.</p>
</body>
</html>

<?
}
else {
mail("scoobyood@jace41.com", $subject,
$message, "From: $name<$email>" );
header( "Location: contactsent.html" );
}
?>

Eric Bohlman
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Contact Form


scoobyood@jace41.com (Jason) wrote in
news:ed5ca32c.0403140030.6d8a2819@posting.google.c om:
[color=blue]
> My server does support php, but I cannot get contact form to work.
> Could use some help to see if any error in php code and appreciate
> help in advance! Jason[/color]

"Doesn't work" isn't a helpful description when you're asking someone to
help you debug your code. You need to state in very specific terms both
what you *want* to happen and what actually *is* happening.

That said, the first thing that pops into my mind is that what does/doesn't
get put into $_REQUEST is a matter of how PHP is configured, and therefore
it's usually better to work directly with $_GET and/or $_POST.
Jason
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Contact Form


Eric Bohlman <ebohlman@earthlink.net> wrote in message news:<Xns94AC2141F5E81ebohlmanomsdevcom@130.133.1. 4>...[color=blue]
> scoobyood@jace41.com (Jason) wrote in
> news:ed5ca32c.0403140030.6d8a2819@posting.google.c om:
>[color=green]
> > My server does support php, but I cannot get contact form to work.
> > Could use some help to see if any error in php code and appreciate
> > help in advance! Jason[/color]
>
> "Doesn't work" isn't a helpful description when you're asking someone to
> help you debug your code. You need to state in very specific terms both
> what you *want* to happen and what actually *is* happening.
>
> That said, the first thing that pops into my mind is that what does/doesn't
> get put into $_REQUEST is a matter of how PHP is configured, and therefore
> it's usually better to work directly with $_GET and/or $_POST.[/color]


My bad, was a sleepy head while typed my previous message and supposed
to give the details, instead of "doesn't work".

Okay let me try to explain: I already created three pages: index.htm
(contact form), sentform.php (check and validate whether fields are
filled and if validated it will redirect to contactsent.htm and email
message), and contactsent.htm (thank you).

As for php script, I got it from

http://www.thesitewizard.com/archive/phptutorial2.shtml

"if and elseif" codes function as validation to check if any field is
missing before proceed to next php code. If all fields aren't filled,
then this page will stop at this point. If all are filled then it
will proceed to next php instruction.

Once pass "if and elseif" codes, then "else" will submit email and
redirect to thank you page.

Okay, here's problem: I tested pages by filled all fields and
submitted, but it stopped at second page (sentform.php) and won't send
email and redirect to thank you page.

I'm not a php freak and I am assume it's "REQUEST" function's a
problem or entire php need to be recode. Hopefully I explained
clearly.

Jason
Jason
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Contact Form


Eric Bohlman <ebohlman@earthlink.net> wrote in message news:<Xns94AC2141F5E81ebohlmanomsdevcom@130.133.1. 4>...[color=blue]
> scoobyood@jace41.com (Jason) wrote in
> news:ed5ca32c.0403140030.6d8a2819@posting.google.c om:
>[color=green]
> > My server does support php, but I cannot get contact form to work.
> > Could use some help to see if any error in php code and appreciate
> > help in advance! Jason[/color]
>
> "Doesn't work" isn't a helpful description when you're asking someone to
> help you debug your code. You need to state in very specific terms both
> what you *want* to happen and what actually *is* happening.
>
> That said, the first thing that pops into my mind is that what does/doesn't
> get put into $_REQUEST is a matter of how PHP is configured, and therefore
> it's usually better to work directly with $_GET and/or $_POST.[/color]


My bad, was a sleepy head while type my previous message and forget to
explain the full details.

Okay, let's see where to start: I already created three pages:
index.htm (contact form), sentform.php (validate to see if all fields
are filled before proceed submit email and redict to thankyou page),
and contactsent.htm (thank you page).

I got php scripts from:

http://www.thesitewizard.com/archive/phptutorial2.shtml

"if and elseif" codes function as validation to see if all fields are
filled before proceed to next php instruction (else). If form fails,
then this page will act as error page to instruct to return back to
contact form and make sure all fields are filled.

"else" code will process the email and redirect page to
contactsent.htm (thank you) if form passed the "if and else" script.

But the problem's: I have tested them by fill all fields and succeed
jump to contactsent.php, but for some reason, sentform.php won't
process the email and redirect to thankyou page. It's my guess that
the "REQUEST"'s problem, but I'm not a php freak since I'm starting to
learning php. Hopefully I explain clearly...

Jason
Closed Thread


Similar PHP bytes