Forum Moderators: coopster
i got a eamail form on a page and then antoher mailinglist form as well. each form calls different scripts, so...
i go to this page and then ignore the mail form but fill in the mailing list form. then i press submit but it is running the mail form script instead!
ive checked the scripts and the forms, and there is no clash in form element name as i can see.
anyone ever encountered this problme?
k
this one is included into the main body..
<form method="post" enctype="multipart/form-data" action="scripts/send_mail.php">
<table>
<tr>
<td>Name: </td><td align="right"><input type=text name="name">
</tr>
<tr>
<td>E-Mail: </td><td align="right"><input type=text name="email">
</tr>
<tr>
<td>Subject: </td><td align="right"><input type=text name="subject">
</tr>
<tr>
<td>Send To: </td><td align="right"><select name="sendto"size=1>
<option>[Sasi]Kumar
<option>Wolfheart
</select>
</tr>
<tr>
<td>Comments: </td>
</tr>
<tr>
<td colspan=2 align="right"><textarea cols=28 rows=4 name="messege"></textarea>
</tr>
<tr>
<td colspan=2 align="right"><input type="submit" value="submit">
</tr>
</table>
<!------------------------------------------------------------------------->
while this is part of the index.php(where the above is included) inside a seperate div:
<div class="sidebox">
<p>
<strong>MAILING LIST</strong>
<br /> Be notified of updates. Your privacy will not be compromised.
<form method="POST" action="scripts/mail_list.php">
<input type="text" name="add" size="10"><br /> <br />
<input type="submit" value="Submit">
</form>
</p>
</div>
as you can see they call a seprate script, so why the mailing list button triggers the email script is beyond me...
i searched on google and saw seeral people with similar problem, but no solution..
k
<?php
//thanks to jatar_k at webmasterworld.com php forum
$emailpattern = '^([._a-zA-Z0-9-]){2,255}@([._a-zA-Z0-9-]){2,255}\.([.a-zA-Z]){2,7}$'; if (!isset($_POST['add']) ¦¦ empty($_POST['add']))
{
echo 'HA! HA! very funny, now ENTER an address befdore you submit, moron!';
}
else if (!ereg($emailpattern, $_POST['add']))
{
echo 'Is it so hard to proviude a proper address....?';
}
else
{
$add = $_POST['add'];
$fh = fopen('adds.php', 'a');
fwrite($fh, $add);
fclose($fh);
echo 'Thank You for signing up to the list. you will get regular updates.';
}
?>
<?phpif ( empty($_POST['name']) ¦¦ empty($_POST['email']) ¦¦ empty($_POST['messege']) ¦¦ empty($_POST['subject']))
{
echo 'Please fill in all fields';
exit();
}
else
{
//thanks to jatar_k at webmasterworld.com php forum
$emailpattern = '^([._a-zA-Z0-9-]){2,255}@([._a-zA-Z0-9-]){2,255}\.([.a-zA-Z]){2,7}$';
if (!ereg($emailpattern, $_POST['email']))
{
echo 'Is it so hard to proviude a proper address....?';
exit();
}
else
{
$name = $_POST['name'];
$email = $_POST['email'];
$messege = $_POST['messege'];
$subject = $_POST['subject'];
//send mail
$mail = mail('kumsi1980@yahoo.co.uk', $subject, $messege, "From: $name, $email");
if($mail)
{
echo 'Your messege has been sent';
}
else
{
echo 'An error occured within the sendmail program. Please go back and try again';
}
}
}
?>