Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-23-2007, 12:23 PM php mail - SOLVED
FutileSoul's Avatar
Ultra Talker

Posts: 383
Location: Michigan
Trades: 0
does anyone see why this wouldn't work. i cannot get it to work at all, it always says i have missing field(s) after i submit the form.

PHP Code:

<?php



$recipientname 
"my name";

$recipientemail "myname@mydomain.com";

$subject "[My Website - Contact]";


?>

<?php
if($_POST['submitform']) {

$Name $HTTP_POST_VARS['Name'];
$Email $HTTP_POST_VARS['Email'];
$Comments $HTTP_POST_VARS['Comments'];


$dcheck explode(",",$require);
while(list(
$check) = each($dcheck)) {
if(!$
$dcheck[$check]) 

{
$error .= "Missing Required Field(s)<br>";
}
}


if ((!
ereg(".+\@.+\..+"$Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$"$Email))){
$error .= "Invalid Email Address<br>";}


if(
$error) {
?>

<b>Error</b><br>
<?php echo $error?><br>
<a href="#" onClick="history.go(-1)">Try Again</a>


<?php
}
else 
{

$browser $HTTP_USER_AGENT;
$ip $REMOTE_ADDR;


$message "Contact:

Name: 
$Name
Email: 
$Email

Comments: 
$Comments

-----------------------------

Browser: 
$browser
User IP: 
$ip";

mail($recipientemail,"$subject","$message","From: $Name <$Email>");

header'Location: http://www.my_website.com' ) ;


}

else {
?>
<br /><br />
<form name="contactform" action="<?php echo $PHP_SELF?>" method="post">
<input type="hidden" name="require" value="Name,Email,Comments">
<table><tr> 
<td colspan="2" align="center"><b>Contact</b><p></td>
</tr><tr> 
<td valign="top" align="right"><strong>Name:</strong></td>
<td valign="top"><input name="Name" type="text" size="25"></td>
</tr><tr> 
<td valign="top" align="right"><strong>E-mail:</strong></td>
<td valign="top"><input name="Email" type="text" size="25"></td>
</tr><tr> 
<td valign="top" align="right"><strong>Comments:</strong></td>
<td valign="top"><textarea name="Comments" type="text" rows="5" cols="35"></textarea></td>
</tr><tr> 
<td colspan="2" align="center"><input type="submit" value="Submit" name="submitform">
<input type="reset" value="Reset" name="reset"></td>
</tr></table>
<br>

</form>
<?php ?>
</font><p></td>
</tr></table>
__________________

Please login or register to view this content. Registration is FREE
- The Congregation of Man

Last edited by FutileSoul; 08-23-2007 at 03:48 PM..
FutileSoul is offline
Reply With Quote
View Public Profile Visit FutileSoul's homepage!
 
 
Register now for full access!
Old 08-23-2007, 12:29 PM Re: php mail
Skilled Talker

Posts: 94
Trades: 0
Where is $required defined in your explode array?
__________________
Sell Templates? Try our
Please login or register to view this content. Registration is FREE
! See a live
Please login or register to view this content. Registration is FREE
ChadR is offline
Reply With Quote
View Public Profile
 
Old 08-23-2007, 12:37 PM Re: php mail
FutileSoul's Avatar
Ultra Talker

Posts: 383
Location: Michigan
Trades: 0
in the mail form

<input type="hidden" name="require" value="Name,Email,Comments">
<table>
__________________

Please login or register to view this content. Registration is FREE
- The Congregation of Man
FutileSoul is offline
Reply With Quote
View Public Profile Visit FutileSoul's homepage!
 
Old 08-23-2007, 01:17 PM Re: php mail
Skilled Talker

Posts: 94
Trades: 0
Then you need to add it in your POST request

PHP Code:
$Name $HTTP_POST_VARS['Name']; 
$Email $HTTP_POST_VARS['Email']; 
$Comments $HTTP_POST_VARS['Comments']; 
// Add This
$require $HTTP_POST_VARS['require']; 
If you are using PHP 5 you might want to look into using $_POST which will work great.
__________________
Sell Templates? Try our
Please login or register to view this content. Registration is FREE
! See a live
Please login or register to view this content. Registration is FREE
ChadR is offline
Reply With Quote
View Public Profile
 
Old 08-23-2007, 01:38 PM Re: php mail
FutileSoul's Avatar
Ultra Talker

Posts: 383
Location: Michigan
Trades: 0
awesome,
thanks chadr it works perfect now.
__________________

Please login or register to view this content. Registration is FREE
- The Congregation of Man
FutileSoul is offline
Reply With Quote
View Public Profile Visit FutileSoul's homepage!
 
Reply     « Reply to php mail
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15155 seconds with 12 queries