baccarak Posted February 25, 2009 Share Posted February 25, 2009 What I know on php you can write on the back of a postage stamp but I am a keen learner and appreciate any help or suggestions on this first hiccup......I have this form: As you can see it is mailed to my subscription list manager (?subscribe) and data held in a flatfile db. This is perfect but does not have the facility to autorespond and notify me of this new subscriber so I have another script to handle this. through process.php. What I want to do is to method=post the info (name and email) in the form to both the subscribe and the process.php in the same button click, is this possible? If it is, it will be invaluable to me echo "<form method=post action=?action=subscribe>"; echo "<Table width=80%><TR><TD width=15%>Name:</TD><TD width=80%><input type='text' name='name' style='font-size:12px'></TD></TR><TR><TD width=15%>Email:</TD><TD width=80%><input type='text' name='email' style='font-size:12px'></TD></TR><TR><TD width=15%><input type=hidden name=group value='$group'><BR><BR></TD><TD width=80%><input type='submit' value='Subscribe' style='font-size:12px'></TD></TR></Table></form>"; Thanks for looking - there is nothing on the web about this (I have looked!!!...lol) but I certain it could help some one else. Quote Link to comment Share on other sites More sharing options...
trq Posted February 25, 2009 Share Posted February 25, 2009 What I want to do is to method=post the info (name and email) in the form to both the subscribe and the process.php in the same button click, is this possible? Why don't you put the code from process.php togther with the code from subscribe? Quote Link to comment Share on other sites More sharing options...
baccarak Posted February 25, 2009 Author Share Posted February 25, 2009 how do u do that? is there any special syntax I use? <form method=post action=?action=subscribe process,php>"; ? Thanks for reply btw Quote Link to comment Share on other sites More sharing options...
trq Posted February 25, 2009 Share Posted February 25, 2009 No, I meen put the code from process.php together with the code from subscribe in the same script. A form can only post to one location. Quote Link to comment Share on other sites More sharing options...
chronister Posted February 25, 2009 Share Posted February 25, 2009 <?php if(isset($_POST['NameOfSubmitButton'])){ // form has been submitted .... process the form now. }else{ // show form here... it has not been submitted echo '<form name="formName" action="'.$_SERVER['PHP_SELF'].'" method="post">'; // rest of form here } ?> This is basically how you would want to do it. Nate Quote Link to comment Share on other sites More sharing options...
baccarak Posted February 25, 2009 Author Share Posted February 25, 2009 [quote <?php if(isset($_POST['NameOfSubmitButton'])){ // form has been submitted .... process the form now. }else{ // show form here... it has not been submitted echo '<form name="formName" action="'.$_SERVER['PHP_SELF'].'" method="post">'; // rest of form here } ?> This is basically how you would want to do it. Nate How would I add this to this code? echo "<form method=post action=?action=subscribe>"; echo "<Table width=80%><TR><TD width=15%>Name:</TD><TD width=80%><input type='text' name='name' style='font-size:12px'></TD></TR><TR><TD width=15%>Email:</TD><TD width=80%><input type='text' name='email' style='font-size:12px'></TD></TR><TR><TD width=15%><input type=hidden name=group value='$group'><BR><BR></TD><TD width=80%><input type='submit' value='Subscribe' style='font-size:12px'></TD></TR></Table></form>"; how would this work? I would be interested to know Kind Regards Quote Link to comment Share on other sites More sharing options...
chronister Posted February 25, 2009 Share Posted February 25, 2009 <?php if(isset($_POST['SUBSCRIBE'])){ echo 'Form Submitted.... Add your processing code here<br />'; echo '<pre>'; print_r($_POST); echo '</pre>'; }else{ echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'">'; echo "<Table width=80%> <TR> <TD width=15%>Name:</TD> <TD width=80%><input type='text' name='name' style='font-size:12px'></TD> </TR> <TR> <TD width=15%>Email:</TD> <TD width=80%><input type='text' name='email' style='font-size:12px'></TD> </TR> <TR> <TD width=15%><input type=hidden name=group value='$group'><BR><BR></TD> <TD width=80%><input NAME="SUBSCRIBE" type='submit' value='Subscribe' style='font-size:12px'></TD> </TR> </Table> </form>"; } ?> Make sure your HTML is proper. Surround your attributes with quotes, and give all your form elements a name. This is the basis for making a 1 page form / form processing page. Nate Quote Link to comment Share on other sites More sharing options...
baccarak Posted February 25, 2009 Author Share Posted February 25, 2009 <?php if(isset($_POST['SUBSCRIBE'])){ echo 'Form Submitted.... Add your processing code here<br />'; echo '<pre>'; print_r($_POST); echo '</pre>'; }else{ echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'">'; echo "<Table width=80%> <TR> <TD width=15%>Name:</TD> <TD width=80%><input type='text' name='name' style='font-size:12px'></TD> </TR> <TR> <TD width=15%>Email:</TD> <TD width=80%><input type='text' name='email' style='font-size:12px'></TD> </TR> <TR> <TD width=15%><input type=hidden name=group value='$group'><BR><BR></TD> <TD width=80%><input NAME="SUBSCRIBE" type='submit' value='Subscribe' style='font-size:12px'></TD> </TR> </Table> </form>"; } ?> Make sure your HTML is proper. Surround your attributes with quotes, and give all your form elements a name. This is the basis for making a 1 page form / form processing page. Nate this is ok to post to subscribe.php but where is the reference in posting to the proccess.php too? (Posting to 2 files not just the one) Regards Quote Link to comment Share on other sites More sharing options...
chronister Posted February 25, 2009 Share Posted February 25, 2009 You would take the code in process.php that handles this form submission, and place it where it says echo 'Form Submitted.... Add your processing code here<br />';... just replace everything inside the { } Nate Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.