Jump to content

Fatal error: Call to undefined function email() in F:\xampp\htdocs\contact.php on line 87


Recommended Posts

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--


-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="homepage.php">Homepage</a></li>
        <li><a href="trip.php">Destinations</a></li>
        <li><a href="contact.php">contact </a></li>
        <li><a href="registration.php">Login</a></li>
        <li><a href="adminlogin.php">Leader</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="../../Documents/Unnamed Site 2/IMG_1913.jpg" width="999" height="388"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      <h2 class="title"><a href="#">Contact US</a></h2>
            <div class="entry">
                <table border='1'>
    
    </div>
<table width="400" border="0" acellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

    


 
</body>
</html>
    

    <?php
     
     
     
    if (isset($_POST['submit'])){
           
            $name = $_POST['name'];
            $email = $_POST['email'];
            $message = $_POST['message'];
           
            $to = "[email protected]";
            $subject = "New Contact us form";
            $message = "A new message has been sent by $email \n
            Their message was $message \n \n
            Their Details: \n
            Name: $name \n
            Email $email \n";
           
           
            if ($name) {
                   
                   
                    if($email) {
                           
                            if ($message){
                                   
                                    email ($to, $subject, $message);
                                   
                                    echo "Thank you for your message";
                                   
                                   
                                   
                            } else {
                                   
                                    echo "Please enter some comments";
                            }
                           
                           
                    } else {
                           
                            echo "Please enter an email address";
                    }
                   
            } else {
                   
                    echo "Please enter your name";
                   
            }
           
           
           
    } else {
     
    //Form Built by TPGS   
    ?>
     
                            <form action="contact.php" method="post">
                            Name: <input type="text" name="name" /><br /><br />
                            Email: <input type="text" name="email" /><br /><br />
                            Message: <textarea name="message" rows="20" cols="40"></textarea><br /><br />
                            <input type="submit" name="submit" value="Submit" />
                           
                            </form>
     
     
    <?php
    }
     
    ?>


 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--


-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
<p><!-- end #header --></p>
<div id="header" class="container">
<div id="logo">
<h1><a href="#">Yakity Yak</a></h1>
</div>
<div id="menu">
<ul>
<li class="current_page_item"><a href="homepage.php">Homepage</a></li>
<li><a href="trip.php">Destinations</a></li>
<li><a href="contact.php">contact </a></li>
<li><a href="registration.php">Login</a></li>
<li><a href="adminlogin.php">Leader</a></li>
<li></li>
<li></li>
</ul>
</div>
</div>
<blockquote>
<blockquote>
<p> <center><img src="../../Documents/Unnamed Site 2/IMG_1913.jpg" width="999" height="388" alt=""/></center> </p>
</blockquote>
</blockquote>
<div id="page">
<div class="post">
<h2 class="title"><a href="#">Contact US</a></h2>
<div class="entry">
<table border='1'>

</div>
<table width="400" border="0" acellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>





</body>
</html>


<?php



if (isset($_POST['submit'])){

$name = $_POST['name'];
$mail = $_POST['email'];
$message = $_POST['message'];

$to = "[email protected]";
$subject = "New Contact us form";
$message = "A new message has been sent by $mail \n
Their message was $message \n \n
Their Details: \n
Name: $name \n
Email $mail \n";


if ($name) {


if($mail) {

if ($message){

mail ($to, $subject, $message);

echo "Thank you for your message";



} else {

echo "Please enter some comments";
}


} else {

echo "Please enter an email address";
}

} else {

echo "Please enter your name";

}



} else {

//Form Built by TPGS
?>

<form action="contact.php" method="post">
Name: <input type="text" name="name" /><br /><br />
Email: <input type="text" name="email" /><br /><br />
Message: <textarea name="message" rows="20" cols="40"></textarea><br /><br />
<input type="submit" name="submit" value="Submit" />

</form>


<?php
}

?>




when i hit submit it wont echo Thank you for your message

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--


-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="homepage.php">Homepage</a></li>
        <li><a href="trip.php">Destinations</a></li>
        <li><a href="contact.php">contact </a></li>
        <li><a href="registration.php">Login</a></li>
		<li><a href="adminlogin.php">Leader</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="../../Documents/Unnamed Site 2/IMG_1913.jpg" width="999" height="388"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      <h2 class="title"><a href="#">Contact US</a></h2>
			<div class="entry">
				<table border='1'>
    
    </div>
<table width="400" border="0" acellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>

	


 
</body>
</html>
	

    <?php
     
     
     
    if (isset($_POST['submit'])){
           
            $name = $_POST['name'];
            $mail = $_POST['email'];
            $message = $_POST['message'];
           
            $to = "[email protected]";
            $subject = "New Contact us form";
            $message = "A new message has been sent by $mail \n
            Their message was $message \n \n
            Their Details: \n
            Name: $name \n
            Email: $mail From:[email protected]\r\n\n";
           
           
            if ($name) {
                   
                   
                    if($mail) {
                           
                            if ($message){
									 
                                     $mail ($to, $subject, $message);
                                   
                                    echo "Thank you for your message";
                                   
                                   
                                   
                            } else {
                                   
                                    echo "Please enter some comments";
                            }
                           
                           
                    } else {
                           
                            echo "Please enter an email address";
                    }
                   
            } else {
                   
                    echo "Please enter your name";
                   
            }
           
           
           
    } else {
     
    //Form Built by TPGS   
    ?>
     
                            <form action="contact.php" method="post">
                            Name: <input type="text" name="name" /><br /><br />
                            Email: <input type="text" name="email" /><br /><br />
                            Message: <textarea name="message" rows="20" cols="40"></textarea><br /><br />
                            <input type="submit" name="submit" value="Submit" />
                           
                            </form>
     
     
    <?php
    }
     
    ?>




Fatalarrow-10x10.png error: Call to undefined function [email protected]() in F:\xampp\htdocs\contactarrow-10x10.png.php on line 87

It's referring to this line here:

$mail ($to, $subject, $message);

What command are you executing there? PHP thinks the command you're executing is

[email protected]();

which is an undefined function.

Edited by aysiu

Heres an updated code 

<?php
ini_set("sendmail_from", "Website <[email protected]>"); 
?> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
 
 
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Yakity Yak</title>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Abel|Satisfy' rel='stylesheet' type='text/css'>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
  <p><!-- end #header --></p>
  <div id="header" class="container">
    <div id="logo">
      <h1><a href="#">Yakity Yak</a></h1>
    </div>
    <div id="menu">
      <ul>
        <li class="current_page_item"><a href="homepage.php">Homepage</a></li>
        <li><a href="trip.php">Destinations</a></li>
        <li><a href="contact.php">contact </a></li>
        <li><a href="registration.php">Login</a></li>
<li><a href="adminlogin.php">Leader</a></li>
        <li></li>
        <li></li>
      </ul>
    </div>
  </div>
  <blockquote>
    <blockquote>
      <p> <center><img src="../../Documents/Unnamed Site 2/IMG_1913.jpg" width="999" height="388"  alt=""/></center>  </p>
    </blockquote>
  </blockquote>
  <div id="page">
    <div class="post">
      <h2 class="title"><a href="#">Contact US</a></h2>
<div class="entry">
<table border='1'>
    
    </div>
<table width="400" border="0" acellpadding="3" cellspacing="1">
<tr>
<td><strong>Contact Form </strong></td>
</tr>
</table>
 
 
 
 
 
</body>
</html>
 
 
    <?php
     
     
     
    if (isset($_POST['submit'])){
           
            $name = $_POST['name'];
            $mail = $_POST['email'];
            $message = $_POST['message'];
           
            $to = "[email protected]";
            $subject = "New Contact us form";
            $message = "A new message has been sent by $mail \n
            Their message was $message \n \n
            Their Details: \n
            Name: $name \n
            Email: $mail From:[email protected]\r\n\n";
           
           
            if ($name) {
                   
                   
                    if($mail) {
                           
                            if ($message){
 
                                     mail($to, $subject, $message);
                                   
                                    echo "Thank you for your message";
                                   
                                   
                                   
                            } else {
                                   
                                    echo "Please enter some comments";
                            }
                           
                           
                    } else {
                           
                            echo "Please enter an email address";
                    }
                   
            } else {
                   
                    echo "Please enter your name";
                   
            }
           
           
           
    } else {
     
    //Form Built by TPGS  
    //Form Edited by Keith ( DrTrans @ PHP Freaks). 
    ?>
     
                            <form action="contact.php" method="post">
                            Name: <input type="text" name="name" /><br /><br />
                            Email: <input type="text" name="email" /><br /><br />
                            Message: <textarea name="message" rows="20" cols="40"></textarea><br /><br />
                            <input type="submit" name="submit" value="Submit" />
                           
                            </form>
     
     
    <?php
    }
     
    ?>
 
Edited by DrTrans

Warning: mailarrow-10x10.png() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in F:\xampp\htdocs\contactarrow-10x10.png.php on line 91
Thank you for your message

Not sure if it is the same but I can't use sendmail from my local Wamp server straight out of the box. I seem to recall there was a way to do it but it was a bit of a PITA.

 

Instead, all I do locally is echo out the email query to make sure it looks like it is doing the correct stuff, then test it properly when I push the page to the live server.

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.