473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PHP undefined variable Email

Hi everyone, Im a php newbie jejeej .

Im getting the following error undefined variable at line 19 , I verified the php.ini and I dont know what else I can do. Im working on IIS with windows xp/2000.
If someone can help , please!!

HTML



<body bgcolor="#000066">
<form action="mail.php" method="post">
<table width="740" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="740" height="330" background="contactenos.jpg"><div align="right">Nombre:
<input type="text" name="name" >
&nbsp;<br/>
Email:
<input type="text" name="email">
&nbsp;<br/>
Comentarios : &nbsp;&nbsp;&nbsp;<br/>
<textarea name="message" cols="40" rows="5" ></textarea>
&nbsp;<br/>
<input name="submit" type="submit" value="Enviar">
&nbsp; </div></td>
<td>&nbsp;</td>
</tr>
</table>
<br/>
</form>



mail.php



<?php

//variables (change these)


$youremail = "nante1181@hotmail.com";
// your email address

$subject = "test form";
// the subject of the email

$thankyou = "thankyou.php";
// thank you page

// don't change anything else

if($email == ""){
?>
<body bgcolor="#000066" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<div align="center"><font face="Verdana, Arial, Helvetica, sans-serif">No introdujo
Email. Por favor vuelva a atras.<br/>
<?php
}elseif($name == ""){
?>
No Introdujo un nombre. Por favor vuelva a atras.<br/>
<?php
}elseif($message == ""){
?>
No Introdujo un mensaje. Por favor vuelva a atras.<br/>
<?php
}else{

$msg = ereg_replace("\\\'", "'", $message);
$msg = ereg_replace('\\\"', "\"", $msg);
$message1 = "from: $name\nemail: $email\nmessage:\n$msg1";

mail($youremail, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
?>
</font></div>
<meta http-equiv="refresh" content="0; url=<?echo $thankyou;?>"">
<?php
}
?>


thanks for your help
Jan 12 '07 #1
2 3498
the error is on if($email=="") it seems the php file its not recognizing the html variable
Jan 12 '07 #2
r035198x
13,262 8TB
the error is on if($email=="") it seems the php file its not recognizing the html variable

//variables (change these)

In
[PHP]$youremail = "nante1181@hotmail.com";
// your email address

$subject = "test form";
// the subject of the email

$thankyou = "thankyou.php";
// thank you page

// don't change anything else

if($email == ""){
?>
[/PHP]

You define and initialize the variables
$youremail, $subject and $thankyou
but did not initiaze $email variable which you go on to try to use in the line
[PHP]if($email == "
[/PHP]
the idea is you must declare variables before you can use them.
PHP will not recognize variables declared inHTML
Jan 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bissatch | last post by:
Hi, I get the following error: Notice: Undefined variable: end_while in C:\Program Files\Apache\Apache2\htdocs\csp\inc\xmlmenu.php on line 102 This is a script that works on the server...
4
by: Mike | last post by:
I am having a problem when a field is spaces being undefined. I wasn't sure if the problem was Excel or Javascript, so I thought I would post here first. The users are able to select from a drop...
4
by: oliver hadfield | last post by:
Hello all I am having a small problem wih a javascript, could anyone help me please 1. first of all this code requires a form f01 and textarea t01 <form name ="f01">
0
by: Dave | last post by:
Hi everyone, (I already posted this to the VS.NET IDE news group without any responses, so I'm attempting one more time in this group) The issue I'm having is occuring in the IDE of VS.NET...
4
by: Hal | last post by:
Can someone please tell me what is wrong with this script? <script language="JavaScript"> <!-- function HF_CloseAllChildren() { if (g_win1) != undefined { if ((g_win1) && !(g_win1.closed))...
8
by: Joona I Palaste | last post by:
We all know that this: void *p; if (p=malloc(1)) { free(p); p; } causes undefined behaviour if malloc() succeeds. But what about this?
1
by: Bob | last post by:
IN JScript, we can use the keyword undefined as follows: if (node!=undefined) { //do something } What is the equivalent of the above in C#? Thanks,
49
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On...
5
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my...
12
by: Franz Hose | last post by:
the following program, when compiled with gcc and '-std=c99', gcc says test.c:6: error: jump into scope of identifier with variably modified type that is, it does not even compile. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.