473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Contact Form

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("sc*******@jace41.com", $subject,
$message, "From: $name<$email>" );
header( "Location: contactsent.html" );
}
?>
Jul 17 '05 #1
3 3350
sc*******@jace41.com (Jason) wrote in
news:ed**************************@posting.google.c om:
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


"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.
Jul 17 '05 #2
Eric Bohlman <eb******@earthlink.net> wrote in message news:<Xn*******************************@130.133.1. 4>...
sc*******@jace41.com (Jason) wrote in
news:ed**************************@posting.google.c om:
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


"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.

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
Jul 17 '05 #3
Eric Bohlman <eb******@earthlink.net> wrote in message news:<Xn*******************************@130.133.1. 4>...
sc*******@jace41.com (Jason) wrote in
news:ed**************************@posting.google.c om:
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


"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.

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
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Jason | last post by:
I'm struggling with this email code and I'm not php freak since I'm starting to learn php stuff. Could use some help... It seems that I get too many parse errors all over and cannot figure went...
1
by: rjbonn | last post by:
I'm setting up a contact list for a musician, who is about to release her first CD. She would like a contact list that can track the people she meets, who will be in various categories -- fans,...
0
by: Robert J. Bonn | last post by:
I am setting up a contact list for a musician, who is about to release her first CD. She would like a contact list that can track all the people she meets, who will be in various categories --...
3
by: John | last post by:
What is the easiest way to make the contact form show on the front page. Meaning on want to keep the front html page and when someone clicks on the contact us link the front page remains the same,...
0
by: kammaldeep | last post by:
hi, i m newbie 2 PHP & to b frank ... will alwaz be ... i dont think i will go into much details with PHP as my work doesnot include workin with PHP bt i have a forum .. and i want to make a...
4
by: thanos | last post by:
Hello, I'm relatively new to PHP so I found this free contact us script on the net that i was going to use for my Contact Us php page. Its works pretty good except for error handling. I was...
5
by: NYXX | last post by:
Here is my Html Code and my Contact.php This is My code in my html <td height="345" valign="top"> <form style="margin:0; padding:0; " action="contact.php" method="get" id="form"> <table...
12
by: colt28 | last post by:
Ok so I found an ajax contact form script but i can't get the b****** to work. I made a bunch of alterations to it and it didn't work so i replaced everything with the original and it still didn't...
8
by: chromis | last post by:
Hi, I'm writing a contacts section for a cms on a website, I've decided to write the section in OO code. So far I have my Contacts object and a page structure I would use for a procedural site. ...
4
by: tokcy | last post by:
HI every one, i am using tooltip on click of link and i want like when that tooltip open then background window would be blure(). can anyone help me...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.