Jump to content

need help


andrew_U

Recommended Posts

i can't seem to find to problem with this php script.

file1: advertise.html

 

<html>

<head>

<title>TundraIRC Advertise</title>

</head>

<body>

 

 

 

If you wish to Advertise on this website please fill out the following form and the Website Director will get back to you ASAP:

 

<form action="advertise.php" method="POST">

<b>First Name</b><br/>

<input type="text" name="firstname" size=40 /><br/>

<b>Last Name:</b>

<input type="text" name="lastname" size=40 /><br />

<b>Company</b><br/>

<input type="text" name="company" size=40 /><br/>

<b>Email</b><br/>

<input type="text" name="email" size=40 /><br/>

<b>Website Address</b><br/>

<input type="text" name="website" size=40 /><br/>

 

<input type="submit" value=" Send ">

</form>

 

file2: advertise.php

 

<html>

<head>

</head>

<body>

<?php

 

$email = $_POST['email'];

$firstname = $_POST['firstname'];

$lastname = $_POST['lastname'];

$company = $_POST['company'];

$website = $_POST['website'];

 

if (mail('[email protected]' , 'TundraIRC Advertisements','Someone wants to adveritse on tundraIRC: ' . $fistname . ' ' . $lastname . ' ' . $company . ' ' . $website . ' ' . $email)) {

  echo "<h4>Thank you for sending email</h4>";

} else {

  echo "<h4>Can't send email to $email</h4>";

}

?>

</body>

</html>

 

when you click "submit" from the first file no information is recieved in the email. how do i fix this?

**[email protected] is an example of the email used

Link to comment
https://forums.phpfreaks.com/topic/98422-need-help/
Share on other sites

From PHP.NET as reference:

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";
// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);
// Send
mail('[email protected]', 'My Subject', $message);
?>

You are using single quotes around variables, when I assume you wanted to actually send the value of the variable, not the name of the variable literally.

<?php
// for readability:
$subject = 'TundraIRC Advertisements';
$message = "Someone wants to advertise on tundraIRC: $firstname $lastname $company website $email";
if (mail($email , $subject,$message)) {
  echo "<h4>Thank you for sending email</h4>";
} else {
  echo "<h4>Can't send email to $email</h4>";
}?>

At this point, you should see one of the two echo commands since mail() returns TRUE if there was nothing wrong with the function's request to send the email, but that doesn't confirm the email will actually reach its destination.

Link to comment
https://forums.phpfreaks.com/topic/98422-need-help/#findComment-503787
Share on other sites

never mind i fixxed it with this:

 


$subject = 'TundraIRC Advertisements';
$message = "Someone wants to advertise on tundraIRC: $firstname $lastname Company: $company Website: $website Email: $email";
$email1 = '[email protected]';
if (mail($email1 , $subject,$message)) {
  echo "<h4>Thank you for sending email</h4>";
} else {
  echo "<h4>Can't send email, try again later</h4>";
}?>

thanks for the advice though

?

Link to comment
https://forums.phpfreaks.com/topic/98422-need-help/#findComment-503793
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.