FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » PHP discussions » Notice: Undefined index: (Notice: Undefined index:)
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Notice: Undefined index: [message #37028] Sat, 28 April 2007 09:01
number1yan is currently offline  number1yan   United Kingdom
Messages: 1
Registered: April 2007
Karma: 0
Junior Member
Can anyone help me,
i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is:
Notice: Undefined index: FriendName in D:\Yan\Over_8\SendEmail.php on line 4, Notice: Undefined index: FriendEmail in D:\Yan\Over_8\SendEmail.php on line 5, Notice: Undefined index: Name in D:\Yan\Over_8\SendEmail.php on line 6, Notice: Undefined index: Email in D:\Yan\Over_8\SendEmail.php on line 7, Notice: Undefined index: emailtext in D:\Yan\Over_8\SendEmail.php on line 8. I have changed in the php.ini file the smtp setting to divert the emails to the my exchange server as this server is seprate and also added the server to the relay list. I can send email from this script still but only externally. I have also tried adding this: error_reporting(E_ALL ^ E_NOTICE); .into the script to hide the errors. It does hide them but the script does not work sending email externally.
My script is: <title>Recommend This Site</title>

<?php
$FriendName = $_POST['FriendName'];
$FriendEmail = $_POST['FriendEmail'];
$Name = $_POST['Name'];
$Email = $_POST['Email'];
$emailtext = $_POST['emailtext'];
$string = $_SERVER['QUERY_STRING'];

?>
<html><head>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>
<body bgcolor="#999999">
<?php
if (!$FriendEmail) {
?>
<br>
<form name="form1" onsubmit="MM_validateForm('Name','','R','Email','','RisEmail ','FriendName','','R','FriendEmail','','RisEmail') ;return document.MM_returnValue" action="" method="POST">
<div align="center">
<table width="427" border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="63" align="right" valign="top"> </td>
<td width="5"><font face="Verdana" size="2"> </font></td>
<td width="138"><font face="Verdana" size="2" color="#FFFFFF">Name: </font> </td>
<td width="216"> <font face="Verdana" size="2" color="#FFFFFF">E-mail:</font></td>
</tr>
<tr>
<td align="right" valign="top">
<font face="Verdana" size="2" color="#FFFFFF">You:</font></td>
<td> </td>
<td>
<font face="Verdana">
<input type="text" name="Name" size="18"><font size="2"> </font></font>
</td>
<td>
<font face="Verdana">
<input type="text" name="Email" size="21"><font size="2"> </font></font>
</td>
</tr>
<tr>
<td align="right" valign="top">
<font face="Verdana" size="2" color="#FFFFFF">Friend:</font></td>
<td> </td>
<td>
<font face="Verdana">
<input type="text" name="FriendName" size="18"><font size="2"> </font>
</font>
</td>
<td>
<font face="Verdana">
<input type="text" name="FriendEmail" size="21"><font size="2"> </font>
</font>
</td>
</tr>
<tr>
<td align="right" valign="top">
<font face="Verdana" size="2" color="#FFFFFF">Message:</font></td>
<td> </td>
<td colspan="2">
<font face="Verdana">
<textarea name="emailtext" cols="38" rows="6" style="font-family: Trebuchet MS; font-size: 10pt">
I found this great website and I believe you would be interested in it.
</textarea><font size="2"> </font></font>
</td>
</tr>
<tr>
<td align="right"> </td>
<td><font face="Verdana" size="2"> </font> </td>
<td>
<font face="Verdana">
<input type="submit" value="Send Message" name="Submit"><font size="2"> </font>
</font>
</td>
<td> </td>
</tr>
</table>
</div>
</form>
<?php
}
else {
if ($FriendEmail) { mail( $FriendEmail, "Message from $Name", "$FriendName, \n\n".$emailtext ."\n\n$Name", "From: $Email");

}


echo "<center><br><br><font color=FFFFFF><font face=Verdana size=2>Thank you <font color=000000>$Name</font><font color=000000>.
<p><br>
<font color=FFFFFF> The email has been sent to <font color=000000>$FriendName</font><font color=000000>.
<p><br>
<br><a href='javascript:window.close();'>Close this window</a></font><p>
<font face=Verdana size=2></a></font></p>";
}
?>
<p> </p>
</body>
</html>

Thanks

[Updated on: Wed, 31 October 2007 09:17]

Report message to a moderator

  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Attaching File To a Page
Next Topic: PHP 4 to PHP 5 object compatibility
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 12:22:21 GMT 2024

Total time taken to generate the page: 0.03001 seconds