Enjoy an ad free experience by logging in. Not a member yet?
Register .
09-13-2009, 05:30 AM
PM User |
#1
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
e-mailing form
hello
i am trying to make a form to be e-mailed to me but have a problem.
i used two different tutorials that i made with dreamweaver and am trying to test it on xampp the first one "untitled-1.php comes up on foxfire with no errors but still cant send it to my email here is the code...
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<?php
if (isset($_POST['Submit'])) {
$to = "myemailaddress";
$subject = "Registration Form";
$body = "hi \n
name: ".$_POST['name']." \n
identification: ".$_POST['identification']." \n
contact: ".$_POST['contact']." \n
age: ".$_POST['age']." \n
education: ".$_POST['education']." \n
computer: ".$_POST['computer']." \n
goal: ".$_POST['goal']." \n
\n
thank you
";
}
mail($to, $subject, $body)
?>
<form id="form1" name="form1" method="post" action="Untitled-1.php">
<table width="100%" border="0" cellpadding="6">
<tr>
<td colspan="2"><div align="center" class="style1">
<div align="center"><strong>form title</strong></div>
</div></td>
</tr>
<tr>
<td width="50%"><div align="right">
<label for="name"><strong>Name</strong></label>
</div></td>
<td width="50%"><div align="left">
<input name="name" type="text" id="name" size="100" maxlength="80" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="identification"><strong>Identification Shown</strong></label>
</div></td>
<td><div align="left">
<input name="identification" type="text" id="identification" size="100" maxlength="300" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="contact"><strong>Contact Information</strong></label>
</div></td>
<td><div align="left">
<textarea name="contact" cols="100" id="contact"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Optional Information</strong></div></td>
<td><div align="left">
<p> </p>
<p><strong>Age Range</strong></p>
<p>
<label>
<input type="radio" name="age" value="radio" id="age_0" />
<strong>16-22</strong></label>
<strong><br />
<label>
<input type="radio" name="age" value="radio" id="age_1" />
23-29</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_2" />
30-36</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_3" />
37-43</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_4" />
44-50</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_5" />
50+</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="education"><strong>Level of Education</strong></label>
</div></td>
<td><div align="left">
<input name="education" type="text" id="education" size="100" maxlength="400" />
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Computer Experience</strong></div></td>
<td><div align="left">
<p>
<label>
<input type="radio" name="computer" value="radio" id="computer_0" />
<strong>Experienced</strong></label>
<strong><br />
<label>
<input type="radio" name="computer" value="radio" id="computer_1" />
Average</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_2" />
Beginner</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_3" />
Poor</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="goal"><strong>goal goal </strong></label>
</div></td>
<td><div align="left">
<p>
<textarea name="goal" cols="100" id="goal"></textarea>
</p>
<p><strong>(example: learning to construct a resume, preparing for a job interview, learning basic computer skills, preparing to write a General Educational Development(GED) exam)</strong></p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Clear Form" />
</div></td>
<td><div align="left">
<label for="submit"></label>
<input type="submit" name="submit" id="submit" value="Submit" />
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
</body>
</html>
the second one untitled-2.php has this error: Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\xampp\htdocs\Untitled-2.php on line 36
and here is this code...(line 36 in bold)
Code:
<?php
/* subject and email variables */
$emailSubject = 'Form Submitted';
$webMaster = 'myemailaddress';
/* Gathering Data Variables */
$nameField = $_POST['name'];
$identificationField = $_POST['identification'];
$contactField = $_POST['contact'];
$ageField = $_POST['age'];
$educationField = $_POST['education'];
$computerField = $_POST['computer'];
$goalField = $_POST['goal'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Identification Shown: $identification <br>
Contact Information: $contact <br>
Optional Information Age: $age <br>
Level of Education: $deucation <br>
What is your main goal while learning at the new ONE Change CALNET Access Center: $goal <br>
EOD;
$headers .= "Content-type: text/html\r\n";
$success - mail($webmaster, $emailSubject, $body, $headers
/* Results rendered as HTML*/
$theresults = <<<EOD
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>
<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "theResults";
?>
<form id="form1" name="form1" method="post" action="Untitled-2.php">
<table width="100%" border="0" cellpadding="6">
<tr>
<td colspan="2"><div align="center" class="style1">
<div align="center"><strong>form title</strong></div>
</div></td>
</tr>
<tr>
<td width="50%"><div align="right">
<label for="name"><strong>Name</strong></label>
</div></td>
<td width="50%"><div align="left">
<input name="name" type="text" id="name" size="100" maxlength="80" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="identification"><strong>Identification Shown</strong></label>
</div></td>
<td><div align="left">
<input name="identification" type="text" id="identification" size="100" maxlength="300" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="contact"><strong>Contact Information</strong></label>
</div></td>
<td><div align="left">
<textarea name="contact" cols="100" id="contact"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Optional Information</strong></div></td>
<td><div align="left">
<p> </p>
<p><strong>Age Range</strong></p>
<p>
<label>
<input type="radio" name="age" value="radio" id="age_0" />
<strong>16-22</strong></label>
<strong><br />
<label>
<input type="radio" name="age" value="radio" id="age_1" />
23-29</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_2" />
30-36</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_3" />
37-43</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_4" />
44-50</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_5" />
50+</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="education"><strong>Level of Education</strong></label>
</div></td>
<td><div align="left">
<input name="education" type="text" id="education" size="100" maxlength="400" />
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Computer Experience</strong></div></td>
<td><div align="left">
<p>
<label>
<input type="radio" name="computer" value="radio" id="computer_0" />
<strong>Experienced</strong></label>
<strong><br />
<label>
<input type="radio" name="computer" value="radio" id="computer_1" />
Average</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_2" />
Beginner</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_3" />
Poor</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="goal"><strong>goal goal </strong></label>
</div></td>
<td><div align="left">
<p>
<textarea name="goal" cols="100" id="goal"></textarea>
</p>
<p><strong>(example: learning to construct a resume, preparing for a job interview, learning basic computer skills, preparing to write a General Educational Development(GED) exam)</strong></p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Clear Form" />
</div></td>
<td><div align="left">
<label for="submit"></label>
<input type="submit" name="submit" id="submit" value="Submit" />
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
</body>
</html>
i think the untitled-1 is ok but just cant get it to send is there someting i should set on xampp or is it the code????
09-13-2009, 06:32 AM
PM User |
#2
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
Quote:
$headers .= "Content-type: text/html\r\n";
$success - mail($webmaster, $emailSubject, $body, $headers
/* Results rendered as HTML*/
Did you mean
Code:
$headers .= "Content-type: text/html\r\n";
$success = mail($webmaster, $emailSubject, $body, $headers);
/* Results rendered as HTML*/
there?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
Users who have thanked abduraooft for this post:
09-13-2009, 08:46 AM
PM User |
#3
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
that fixed that up - look like = on youtube tutorials but still cant receive the e-mail.
im not sure about the "webmaster" that was just in the tutorial too.
Is it something different when sending to a hotmail.com address
09-13-2009, 09:00 AM
PM User |
#4
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
Quote:
$webMaster = 'myemailaddress';
Quote:
Is it something different when sending to a hotmail.com address
Yes, replace that part with the email id to which you need to send the message.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
09-13-2009, 09:23 AM
PM User |
#5
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
yeah i did just put that there so my address isnt on the forum
i used a my hotmail.com, gmail.com, and yahoo.com too and never received anything not even in the spam.
can it be something in the xampp???
09-13-2009, 09:34 AM
PM User |
#6
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
Quote:
can it be something in the xampp???
If you are testing from a Windows machine, you need to have an SMTP server running in it.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
09-13-2009, 06:32 PM
PM User |
#7
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
yeah i woke up thinking the same thing but how do i set up xampp for that??
the SMTP service says DEACTIVATED
Last edited by Netjunky; 09-13-2009 at 06:58 PM ..
09-13-2009, 07:59 PM
PM User |
#8
New Coder
Join Date: Jul 2009
Posts: 91
Thanks: 5
Thanked 6 Times in 6 Posts
Be aware that the anti-spam policy of hotmail/gmail/others does not necessarily mean 'spam' will ever get as far as a spam directory. If the sending IP does not have a valid DNS ptr record or the IP is blacklisted for being in a dialup/dsl range(such as a home server running on dsl/cable connection) chances are you'll never see the mail. You may be lucky and get greylisted for a few minutes, but you'll probably get dropped, so pay attention to the SMTP service logs.
If you want to test it against my anti-spam feel free to fire it at
cf13092009@wibblywobblyteapot.co.uk . If I reply, I got it. If not, it got blocked. I'm happy to look in the logs and tell you why.
Hope that's helpful or useful to you in some way. If you are after a good free SMTP/MAIL server for windows Mailenable standard is pretty good, easy to install and free.
09-13-2009, 10:52 PM
PM User |
#9
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
If you want to test it against my anti-spam feel free to fire it at [email
cf13092009@wibblywobblyteapot.co.uk[/email]. If I reply, I got it. If not, it got blocked. I'm happy to look in the logs and tell you why.
sent it to that email address
[QUOTE=
If you are after a good free SMTP/MAIL server for windows Mailenable standard is pretty good, easy to install and free.[/QUOTE]
got Mailenable standard but when i got to the 3 box it said "World Wide Web Publishing Service has not been installed on this computer". there's always something
where or how do i install that little gem..
and found out that its not able to be installed on my system xp home
Last edited by Netjunky; 09-14-2009 at 01:28 AM ..
09-14-2009, 06:35 AM
PM User |
#10
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
ok i borrowed windows server 2003 and am putting it on my other pc is there anything special i should do so both pcs can use it ?
there both connected to my router.
09-14-2009, 08:10 AM
PM User |
#11
New Coder
Join Date: Jul 2009
Posts: 91
Thanks: 5
Thanked 6 Times in 6 Posts
Yep, XP home has IIS missing AFAIR, but let's not jump too far ahead here. If all you are trying to do is send mail from PHP and you are running on windows you should be able to make use of your ISP's SMTP server. This will probably require authentication, and a quick google has thrown up this;
http://email.about.com/od/emailprogr...t/et073006.htm
What you have done is added a remote SMTP server on your network in the shape of that W23K box, so the link will equally apply to that server or your ISP's mail server)
Personally, unless you are sending 'bulk' mail, Your ISP mail server is probably going to be the better option. I imagine it is set up properly, with correct DNS entries, host name and does not have a blacklisted IP. Square to that, your W23K box is probably going to be on your DSL/Cable/dynamic IP address without correct entries in DNS. This most likely means any email coming from it will be dropped by anti-spam measures. Usually It won't make it as far as a 'spam' mailbox - it will be dropped during the SMTP conversation and sit in the outbound queue.
I hope this helps :-)
Last edited by clunk.werclick; 09-14-2009 at 08:18 AM ..
09-14-2009, 08:27 PM
PM User |
#13
New Coder
Join Date: Jul 2009
Posts: 91
Thanks: 5
Thanked 6 Times in 6 Posts
Do you have any messages in the apache error logs or mail server logs?
09-18-2009, 12:41 AM
PM User |
#14
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
clunk.werclick
Do you have any messages in the apache error logs or mail server logs?
Mon Sep 14 16:30:34 2009] [error] [client 127.0.0.1] script 'C:/xampp/xampp/htdocs/untitled-1.php' not found or unable to stat
thats the only log in C:\xampp\xampp\apache\logs
i have even installed windows server 2003 and followed these tutorial
http://www.visualwin.com/PHP/
http://www.simongibson.com/intranet/php2003/
still cant do nothing with it but the tutorials dont tell you how to open the .php or where to put it.
but i did this one first i dont know if it would make any difference
http://win2k3.msfn.org/
why cant they just make things easy??
Last edited by Netjunky; 09-18-2009 at 12:43 AM ..
09-22-2009, 07:06 AM
PM User |
#15
New Coder
Join Date: Sep 2009
Posts: 34
Thanks: 2
Thanked 0 Times in 0 Posts
ok
i got a domain name and have a host server
i can send emails to my domain mail address and redirect it to my hotmail address but still cant send the form to my email the host server is hosthelper
if anyone knows what is wrong with this code please respond
here is the new code
<?php
/* subject and email variables */
$emailSubject = 'Form Submitted';
$webMaster = 'my emil address.co.cc';
/* Gathering Data Variables */
$nameField = $_POST['name'];
$identificationField = $_POST['identification'];
$contactField = $_POST['contact'];
$ageField = $_POST['age'];
$educationField = $_POST['education'];
$computerField = $_POST['computer'];
$goalField = $_POST['goal'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Identification Shown: $identification <br>
Contact Information: $contact <br>
Optional Information Age: $age <br>
Level of Education: $deucation <br>
What is your main goal : $goal <br>
EOD;
$headers .= "Content-type: text/html\r\n";
$success = mail($webmaster, $emailSubject, $body, $headers);
/* Results rendered as HTML*/
$theresults = <<<EOD
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>
<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "theResults";
?>
<form id="form1" name="form1" method="post" action="file:///C|/Documents and Settings/All Users/Documents/Untitled-2.php">
<table width="100%" border="0" cellpadding="6">
<tr>
<td colspan="2"><div align="center" class="style1">
<div align="center"><strong>form title</strong></div>
</div></td>
</tr>
<tr>
<td width="50%"><div align="right">
<label for="name"><strong>Name</strong></label>
</div></td>
<td width="50%"><div align="left">
<input name="name" type="text" id="name" size="100" maxlength="80" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="identification"><strong>Identification Shown</strong></label>
</div></td>
<td><div align="left">
<input name="identification" type="text" id="identification" size="100" maxlength="300" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="contact"><strong>Contact Information</strong></label>
</div></td>
<td><div align="left">
<textarea name="contact" cols="100" id="contact"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Optional Information</strong></div></td>
<td><div align="left">
<p> </p>
<p><strong>Age Range</strong></p>
<p>
<label>
<input type="radio" name="age" value="radio" id="age_0" />
<strong>16-22</strong></label>
<strong><br />
<label>
<input type="radio" name="age" value="radio" id="age_1" />
23-29</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_2" />
30-36</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_3" />
37-43</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_4" />
44-50</label>
<br />
<label>
<input type="radio" name="age" value="radio" id="age_5" />
50+</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="education"><strong>Level of Education</strong></label>
</div></td>
<td><div align="left">
<input name="education" type="text" id="education" size="100" maxlength="400" />
</div></td>
</tr>
<tr>
<td><div align="right"><strong>Computer Experience</strong></div></td>
<td><div align="left">
<p>
<label>
<input type="radio" name="computer" value="radio" id="computer_0" />
<strong>Experienced</strong></label>
<strong><br />
<label>
<input type="radio" name="computer" value="radio" id="computer_1" />
Average</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_2" />
Beginner</label>
<br />
<label>
<input type="radio" name="computer" value="radio" id="computer_3" />
Poor</label>
</strong><br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="goal"><strong> What is your main goal </strong></label>
</div></td>
<td><div align="left">
<p> </p>
<p>
<textarea name="goal" cols="100" id="goal"></textarea>
</p>
<p><strong>(example: learning to construct a resume, preparing for a job interview, learning basic computer skills, preparing to write a General Educational Development(GED) exam)</strong></p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Clear Form" />
</div></td>
<td><div align="left">
<label for="submit"></label>
<input type="submit" name="submit" id="submit" value="Submit" />
</div></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><div align="left"></div></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
</body>
</html>
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 01:49 AM .
Advertisement
Log in to turn off these ads.