Notice: Undefined variable: Name

the mail() function

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Sat Jul 02, 2011 8:29 pm

Notice: Undefined variable: Name

Postby play007 » Sat Jul 02, 2011 8:39 pm

Hi all, i 'm a newbie in PHP. Now i want to create a popup contact us form. As below is what i done so far:-
I have a page

Code: Select all

<script  type="text/javascript" language="javascript">
      $(".QTPopup").animate({width: 'show'}, 'slow');})
         $(".QTPopup").css('display', 'none');
<div id="main">
     <div id="leftpanel">
                       <a href="#" class="lnchPopop">Solutions,Services & Partnerships </a><br/><br/><br/>
<form name="form1" method="post" action="send_contact.php">
<table width="100%" cellpadding="0" cellspacing="0">
<input name="Name" type="text" id="Name" style="border:0px;  background:none; margin-top:5px; width:245px;"/>
<input type="submit" name="Submit" value="Submit" >

and i have another page which is call send_contact.php

Code: Select all

 <TITLE>New Document</TITLE>


$Name ="$Name";
// Details

// Mail of sender
// From
$header="from: $Name <$mail_from>";

// Enter your email address
$to ='';


// Check, if message sent to your email
// display message "We've recived your information"
echo "We've recived your contact information";
else {
echo "ERROR";


But why i get this error "Notice: Undefined variable: Name in C:\xampp\htdocs\content\send_contact.php on line 9" ???

*p/s: actually i ignore another elements such as msg, email and etc. Coz these elements also have a same error msg like name.

any help is appreciated.
thank you.


New php-forum User
New php-forum User
Posts: 101
Joined: Tue Jul 05, 2011 5:41 am
Location: Portugal

Re: Notice: Undefined variable: Name

Postby jorgepinho » Wed Jul 06, 2011 2:21 pm


Code: Select all

$Name ="$Name";

This code is bad, the second $Name doesnt exist yet, you probably need:

Code: Select all

$Name = $_POST['Name'];

but this code is very insecure, so use:

Code: Select all

$Name = htmlspecialchars($_POST['Name']);

Live Help on Skype:
(languages: english, portuguese)

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest