FirstBorn Posted February 16, 2009 Share Posted February 16, 2009 Hi, Thank you for reading and for helping. Can a 'form action' code execute more than one action? Here's what I'm looking to do; A form on one of My sites has a spot where someone enters their name and email address. This info goes to the Email List Software script. I would also like for that data to be sent to My email inbox. I know the mailto: code and how to collect the info ex. <?php if(isset($_post["submit"])) { $name = $_post['name']; $email = $_post['email']; $mailto = "me@mysite.com"; $mailsubj = "New Form Submission"; $mailbody = "$name has submitted info on your form with $email as their email address"; $mailhead = "Headers Go Here!"; mail($mailto, $mailsubj, $mailbody, $mailhead); } Else { ?> <?php // All code of page goes above if not submitted form, // else, execute this the php code at the top and end // here! } ?> The issue here is that the form action code goes to a different server on a different script, so I am able to collect the info on My site, but can't execute it to a script on MY site on the same form action code. Or can I? Here's an example of what I have: <form method="post" action="http://scripts.webhost.com/add_list.cgi"> <input type="hidden" name="list" value="FromEmailAddress" /> <input type="hidden" name="domain" value="DomainName" /> <input type="hidden" name="url" value="SubscribedURL" /> <input type="hidden" name="unsuburl" value="UnsubscribedURL" /> <input type="hidden" name="alreadyonurl" value="AlreadyOnURL" /> <input type="hidden" name="notonurl" value="NotOnURL" /> <input type="hidden" name="invalidurl" value="InvalidURL" /> <input type="hidden" name="emailconfirmurl" value="EmailConfirmURL" /> <input type="hidden" name="emailit" value="1" /> Name: <input name="name" /> E-mail: <input name="email" /><br /> <input type="submit" name="submit" value="Join Our Announcement List" /> <input type="submit" name="unsub" value="Unsubscribe" /> </form> Any ideas to be able to submit the code to the other server AND also collect the data and send it to MY inbox via MY script? Thank you VERY MUCH in advance for your help! Thanks, Christopher Quote Link to comment Share on other sites More sharing options...
Stephen68 Posted February 16, 2009 Share Posted February 16, 2009 Not really sure what you are asking, you have a 3rd party to do your form processing for you? and you can not change the code they have for processing the form? If your server supports PHP why not just write your own form processing script, if it's like the one you showed above it should be easy enough to do. Quote Link to comment Share on other sites More sharing options...
.josh Posted February 16, 2009 Share Posted February 16, 2009 You can use ajax to send multiple requests without actually submitting a form and reloading the whole page. Moving topic to ajax forum. Quote Link to comment Share on other sites More sharing options...
a-scripts.com Posted February 16, 2009 Share Posted February 16, 2009 I am not sure he wanted to use ajax. As you can not use ajax to send request to diferrent servers. He just needs a user to fill a form and submit it .. then the form should get processed by local script and then send to remote script. I think that processing the form on local server is obvious. If you want to pass the form to remote server you should do it using POST method. You can do this using header, socket or curl funcitons. http://www.jonasjohn.de/snippets/php/post-request.htm - sockets http://coding.derkeiler.com/Archive/PHP/php.general/2008-09/msg00172.html - header http://answers.yahoo.com/question/index?qid=20070414080209AA3QiTt - curl Quote Link to comment Share on other sites More sharing options...
FirstBorn Posted February 17, 2009 Author Share Posted February 17, 2009 Hello Everyone! Thank you ALL for replying. First, Why was this moved to AJAX? I want to use php and html... I'm not familiar with AJAX... k, basically, to try to make this less confusing, the form action code needs to go to a different script on a different server to collect the name and email address to add the visitor to an "announcement list." Problem is, I want to be able to grab that info (the name and email address) and send it to MY inbox BEFORE the info is sent to the other server's script. That means, basically the goal: 1. Data is collected (name and email) 2. Data sent to My Inbox 3. Data then sent to script on different server 4. Procedure complete... So, I guess that I would have to collect the data, send it to My Inbox and, I guess, resubmit the form (with the form's data) via code to the script on different server. How would I go about doing this? Thanks, Christopher 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.