Jump to content

Can a Form Execute More Than 1 Action?


FirstBorn

Recommended Posts

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

 

Link to comment
Share on other sites

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.

 

 

 

Link to comment
Share on other sites

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

 

 

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.