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@email.com' , '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@email.com is an example of the email used

Link to comment
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('caffinated@example.com', '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
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@email.com';
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.