What wrong with this code?


#1

I am having trouble with this code. The submit button is not sending an email like it suppose to. I used my email address as a simple test email for this code.






First Name

Last Name

Email Address



Type your message here.






#2

Could you post your code that might help people figure out whats wrong.


#5

<form id="formContactUs" action="http://net-shapers.com/cgi-bin/formmail.pl" method="POST"><input type="hidden" name="subject" value="Contact Us" /> <input type="hidden" name="recipient" value="info@lsprs.org" /> <input type="hidden" name="redirect" value="http://lsprs.org/thank-you/" />
<div class="form_wrap" style="margin: 18px;">
<div class="form">
<div><label style="padding-left: 2px;" for="firstname">First Name</label>
<input id="firstname" style="margin-bottom: 15px;" type="text" name="firstname" size="28" /></div>
<div><label style="padding-left: 2px;" for="firstname">Last Name</label>
<input id="lastname" style="margin-bottom: 15px;" type="text" name="lastname" size="28" /></div>
<div><label style="padding-left: 2px;" for="email">Email Address</label>
<input id="email" style="margin-bottom: 15px;" type="text" name="email" size="28" /></div>
</div>
<div class="form" style="min-height: 125px; margin-bottom: 5px;">
<div style="float: left;"><label style="padding-left: 2px;" for="message">Type your message here.</label>
<textarea id="message" style="margin-bottom: 15px;" name="message" rows="5" cols="100"></textarea></div>
</div>
</div>
<div class="clear"></div>
<div style="float: right;"><input class="submit_but" style="margin-right: 17px; margin-top: 20px;" type="image" name="submit" value="Send Your Message" src="../wp-content/themes/nsTheme/images/contactbutton.jpg" /></div>
</form>[details=Summary]This text will be hidden[/details]`Preformatted text`

#6

I think you got to look at the:

src="..

#7

I have changed the code a bit. and it's still not working. What i'm trying to do, is to send an email without opening my outlook.
host page:

<form action="LSPRS test2.php" method="post">
<ul style="list-style-type: none;">
<li>Name: <input type="text" name="name" size="30" maxlength="40"/></li>
<li>&nbsp;</li>
<li>Email: <input type="text" name="email" size="30" maxlength="40"/></li>
<li>&nbsp;</li>
<li><input type="submit" name="submit" value="Send"/></li>
</ul>
</form>

PHP site code:

<php>
@extract($_POST);
$admin = 'steven1lee@yahoo.com' ; // Change to your admin email 'from' address
$subject = 'Tutorial URLs'; //Your email subject
$name = stripslashes($name); //can be stripslashes('name');
$email = stripslashes($email);
// Your HTML message with table, links and images
$message = '
<html>
<head><content type="text/html"; charset=utf-8>
<title>HTML & CSS Tutorial</title>
</head>
<body>
<p style="color: red;"><img src="http://www.wickham43.net/images/orangew90x90.jpg" alt="Orange W"> Here are some urls regarding my tutorial</p>
<table border="1" cellspacing="2" cellpadding="20" bgcolor="#eeeeee">
<tr>
<th>Introduction</th><th>Contents</th><th>Useful Sites</th>
</tr>
<tr>
<td><img src="http://www.wickham43.net/images/green16x16.jpg" alt="Green Square"/> <a href="http://www.wickham43.net/">Introduction</a></td>
<td><img src="http://www.wickham43.net/images/green16x16.jpg" alt="Green Square"/> <a href="http://www.wickham43.net/contents.php">Contents</a></td>
<td><img src="http://www.wickham43.net/images/green16x16.jpg" alt="Green Square"/> <a href="http://www.wickham43.net/lists.php">Lists</a></td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// Additional headers as http://php.net/manual/en/function.mail.php
$headers .= 'From: Your Name <mail@your-domain.com>' . "\r\n";
//ACTIVE mail below to $admin (you) and $email (the other person)
mail( $admin, "Feedback: $subject", "$name $email", "From: $admin>" );
$send_contact=mail("$name <$email>", "Feedback: $subject", $message, $headers );
if($send_contact){
echo "Thanks," . $name. ", I have sent you an email with the information.";
}
else {
echo "ERROR";
}
</php>

is there something wrong with this code?


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.