plodos Posted April 30, 2008 Share Posted April 30, 2008 When I click to send in the newWindow, there is not sending the emails and there is no error when I click to send that makes refresh... if I click the " click here ", script calls w4ftell.js and sendpage.php from the main directory and also I used in the form action="<?php echo $_SERVER['PHP_SELF']; ?> but everything is same.. what can be the errors!!! footer.php <script language="JavaScript" src="../w4ftell.js"></script> To send a link <a href="javascript:newWindow('../sendpage.php?'+document.location.href,'tell',400,300,'')">click here.</a> sendpage.php <html><head> <style type="text/css"> <!-- td { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } body { margin: 0px; padding: 0px; } .menu { color: #FFFFFF; text-decoration: underline; } --> </style> <script language="JavaScript" src="w4ftell.js"></script> </head> <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <?php if (!$friendemail1) { ?> <br> <form action="" method=POST> <table width="390" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="95" align="right" valign="top"> </td> <td width="1"> </td> <td width="100">Name: </td> <td width="194"> E-mail:</td> </tr> <tr> <td align="right" valign="top"><b>I am:</b></td> <td> </td> <td> <input type="text" name="name" size="15"> </td> <td> <input type="text" name="email" size="20"> </td> </tr> <tr> <td align="right" valign="top"><b>Friend 1:</b></td> <td> </td> <td> <input type="text" name="friendname1" size="15"> </td> <td> <input type="text" name="friendemail1" size="20"> </td> </tr> <tr> <td align="right" valign="top"><b>Friend 2:</b></td> <td> </td> <td> <input type="text" name="friendname2" size="15"> </td> <td> <input type="text" name="friendemail2" size="20"> </td> </tr> <tr> <td align="right" valign="top"><b>Message:</b></td> <td> </td> <td colspan="2"> <textarea name="text" cols="35" rows="6"> I found this great website and I believe you would be interested. Click here to visit the page: <?php echo $QUERY_STRING ?> </textarea> </td> </tr> <tr> <td align="right"><b></b></td> <td> </td> <td> <input type="submit" value=" Send " name="Submit" onClick="MM_validateForm('name','','R','email','','RisEmail','friendname1','','R','friendemail1','','RisEmail','friendemail2','','NisEmail','friendemail3','','NisEmail','text','','R');return document.MM_returnValue"> </td> <td> </td> </tr> </table> </form> <?php } else { if ($friendemail1) { mail( $friendemail1, "Message from $name", "$friendname1, \n\n".$text ."\n\nYour friend,\n $name", "From: $email"); } if ($friendemail2) { mail( $friendemail2, "Message from $name", "$friendname2, \n\n".$text ."\n\nYour friend,\n $name", "From: $email"); } echo "<center><br><br>Thank you. Your friends have been notified.<br><br><hr=size=1> <br><br><a href='javascript:window.close();'>Close this window</a>"; } ?> </body> </html> f4ftell.js function newWindow(mypage,myname,w,h,features) { if(screen.width){ var winl = (screen.width-w)/2; var wint = (screen.height-h)/2; }else{winl = 0;wint =0;} if (winl < 0) winl = 0; if (wint < 0) wint = 0; var settings = 'height=' + h + ','; settings += 'width=' + w + ','; settings += 'top=' + wint + ','; settings += 'left=' + winl + ','; settings += features; win = window.open(mypage,myname,settings); win.window.focus(); } 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_validateForm.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 == ''); } Link to comment https://forums.phpfreaks.com/topic/103649-solved-tell-a-friend-problem/ Share on other sites More sharing options...
plodos Posted May 1, 2008 Author Share Posted May 1, 2008 SOLVED!!! Link to comment https://forums.phpfreaks.com/topic/103649-solved-tell-a-friend-problem/#findComment-530769 Share on other sites More sharing options...
pmoore Posted June 3, 2008 Share Posted June 3, 2008 plodos, can you share how you solved the problem? I'm trying to use (it looks like) the same script and add two more friends and can't get it to validate either. Link to comment https://forums.phpfreaks.com/topic/103649-solved-tell-a-friend-problem/#findComment-556995 Share on other sites More sharing options...
pmoore Posted June 3, 2008 Share Posted June 3, 2008 forgot, here's my thread... http://www.phpfreaks.com/forums/index.php/topic,200270.0.html Link to comment https://forums.phpfreaks.com/topic/103649-solved-tell-a-friend-problem/#findComment-556998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.