Jump to content

Archived

This topic is now archived and is closed to further replies.

heyyderr

Submitting to two Scripts

Recommended Posts

I was wondering if it would be possible to fill out one form and submit the values to two different scripts. To be more detailed, the following is what I want to do:

1) I have a form (http://nextphazeonline.com/guestbook/gbook.php?a=sign) on my guest book form.
2) I'd like to have a checkbox added, that says "Join Newsletter"
3) When the poster checks the "Join Newsletter" checkbox, it would post their comment AND add them to the newsletter.
4) The mailing script is on a different page (http://nextphazeonline.com/mail/) but can be integrated into other pages.

I'm not really familiar with PHP so detailed instructions on how to integrate this would greatly be appreciated. I've included the coding for the Guestbook and Newsletter below for referece. Thanks!

[b]Guestbook Form[/b]
[code]<!--GuestBook Script Begins-->
<form action="http://www.nextphazeonline.com/gbook.php" method="post">
<input type="hidden" name="a" value="add">
<b>Name:</b><br/>
<input type="text" name="name" size="30" maxlength="30" value="">
<b>Location:</b><br/>
<input type="text" name="from" size="30" maxlength="30" value="">
<b>E-mail:</b><br/>
<input type="text" name="email" size="30" maxlength="50" value="">
<b>Comment:</b><br/>
<input type="text" name="name" size="30" maxlength="30" value="">
<textarea name="comments" rows="9" cols="50"></textarea>
<input type="submit" value=" Add my comments ">
<!--GuestBook Script Ends-->[/code]

[b]Newsletter Form[/b]
[code]<!--Newsletter Script Begins-->
<form action="http://nextphazeonline.com/mail/process.php" method="post">
<input type="hidden" name="lists" value="1">
<input type="hidden" name="action" value="sub">
<b>Email address:</b><BR>
<input type="text" name="email" size="30"><p></p>

<input type="submit" value="Submit">
</form>
<!--Newsletter Script Ends-->[/code]

Share this post


Link to post
Share on other sites
You could do it, but, you would need to edit the post page, in your case 'gbook.php' to have a clause REMOTLY like:

[code]
if (isset($_POST['checkbox'])) {
    $found = mysql_result(mysql_query("SELECT count(*) FROM `newsletter_table` WHERE `uEmail` = '".$_POST['email']."' LIMIT 1"), 0, 0)
     if ($found == 0)
          mysql_query("INSERT INTO `newsletter_table` VALUES ( `uEmail` );
     }
}
[/code]
This is assuming your newsletter e-mails are stored in a mysql databse. Also you would need to edit your http://nextphazeonline.com/guestbook/gbook.php?a=sign form to have a checkbox input like

[code]
<input name="checkbox" type="checkbox" value="" />
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.