Jump to content


Submitting to two Scripts

  • Please log in to reply
1 reply to this topic

#1 heyyderr

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 08 September 2006 - 01:17 AM

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://nextphazeonli...book.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!

Guestbook Form
<!--GuestBook Script Begins-->
<form action="http://www.nextphazeonline.com/gbook.php" method="post">
<input type="hidden" name="a" value="add">
<input type="text" name="name" size="30" maxlength="30" value="">
<input type="text" name="from" size="30" maxlength="30" value="">
<input type="text" name="email" size="30" maxlength="50" value="">
<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-->

Newsletter Form
<!--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">
<!--Newsletter Script Ends-->

#2 Nhoj

  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 September 2006 - 02:00 AM

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

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` );
This is assuming your newsletter e-mails are stored in a mysql databse. Also you would need to edit your http://nextphazeonli...book.php?a=sign form to have a checkbox input like

<input name="checkbox" type="checkbox" value="" />

Avid PHP Developer, need some work done? Send a PM ;)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users