PDA

View Full Version : Simple form problem


Nightfire
08-27-2002, 11:23 PM
<br>
<script type="text/javascript" language="javascript">
<!--
function openPopup(){
window.open("","_popup","toolbars=0,location=0,width=180,height=70");
return true;
}
//-->
</script>

<form method="post" name="form" action="../../members/emt.php" target="_popup" onsubmit="return openPopup()">
<table cellspacing="3" cellpadding="3" border="0" align="center" width="80%" class="ETF">
<tr>
<td valign="top">
Enter your friends' email address in the box below. If you want to email it to more than one person, separate the adresses by using commas.
</td>
</tr>
<tr>
<td valign="top" align="center">
<table cellpadding="3" cellspacing="3" border="0">
<tr>
<td>
<input type="text" name="emails">
</td>
<td valign="middle">Your friends' email address</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="hidden" value="<?=$dir?>">
<input type="submit" name="submit" value="Send email">
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>


$dir gets the name of the directory the form is in, so for example, the value of the hidden input is Nightfire. Now when the form is submitted, the email addresses are processed ok, but the value $dir is not being sent to the emails. Here's the other page:


<?
$adminemail = "noreply@chatterspics.com";
$URL = "http://chatterspics.com";
?>
<html>
<head>
<title>Your profile has now been sent</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/style2.css"/>
</head>
<body>
<div align="center">
<?
mail("$emails","An invite to see $dir's photo","Hi there,
I just wanted to show you my photo at ChattersPics.com. Just click on the link below to see me.

$URL/users/$dir","From: $adminemail");
echo "Your profile has now been emailed to your friends!";
?>
<br><br>
<a href="javascript:window.close()">[ Close window ]</a>
</div>
</body>
</html>


Anyone got any ideas? It's got me stumped. If you want to test the email form out, then I have an example here http://chatterspics.com/users/Nightfire You'll see how the emails look

mordred
08-27-2002, 11:57 PM
<input type="hidden" name="dir" value="<?=$dir?>">


I guess you have to name the input field accordingly.

P.S: Have a nice surprise by setting error_reporting(E_ALL); in the first line of your script - very useful for debugging. ;)

Nightfire
08-28-2002, 12:02 AM
:o Can you tell I've had a long day? LOL Can't believe I never noticed I never named the input :o

I'll try that error code thing now :) Ta

mordred
08-28-2002, 12:21 AM
I can relate to your feeling. I had once a terrible time adjusting a script, for more than two hours nothing seemed to work: No changes whatsoever appeared when I looked at it's output in the browser. Finally, not even the error tracing echo() messages were appearing.

It was only then that I realized I had opened the right file in my browser, but from the production server, and not from my local test server instead (which was the one I edited the whole time)... I felt like banging my head on the keyboard (don't ask where that bruise came from).