Jump to content

[?] Form with two actions?


justinede

Recommended Posts

Hey guys,

I was making a script for my friend and he needed a way to do things with one form.

I knew we could do this in the php but it turns out he needs it to submit to a pearl script then, submit to my homemade script which takes information filled out into the form and fills it into a form on the next page.

I had my homemade script working fine. I just need a way to get that pearl script submitted along with my homemade one.

 

So, is there any way to get to actions with one form? I have seen the javascript version but it dosnt work.

Is there a way in PHP to execute a pearl script before my action takes place?

 

Im not sure if this all makes sense but if it dosnt please let me know.

Link to comment
Share on other sites

can you change the perl script you could tell it to go to your script when it finishes or have it submit to your php script then you something like cURL to call the perl script at the top of your script then when that finishes run your script but all this slows down processing of the request

 

Scott.

Link to comment
Share on other sites

i dont mind about the time, but i dont know jack shi* about pearl.

 

In the php, once the user hits submit its supposed to go to a page with a "email=$email" in it so the email field is auto filled out with what you put into that field on page 1. The pearl just adds them to a mailing list.

Link to comment
Share on other sites

ok but what do i need from that link you posted?

All of it?

 

this.

<?php

$ch = curl_init( );
curl_setopt( $ch, CURLOPT_URL, "http://www.google.com" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$response = curl_exec( $ch );
print $response;

?>

 

or this.

<?php

$ch = curl_init( );
curl_setopt( $ch, CURLOPT_URL, "http://www.google.com" );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS, "username=Third_Degree&password=youwish" );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
$response = curl_exec( $ch );
print $response;

?>

 

they definitely look different.

Link to comment
Share on other sites

do you want to send POST data to the perl script or GET

if you have get then change the url in the first example to

curl_setopt( $ch, CURLOPT_URL, "http://www.perlscript?email={$email}" );

if you want POST then use the second example and change

curl_setopt( $ch, CURLOPT_POSTFIELDS, "email={$email}" );

 

Scott.

Link to comment
Share on other sites

ok i added that to my script and it didnt work. here is my script.

 

<?php  

curl_setopt( $ch, CURLOPT_URL, "http://www.aweber.com/scripts/addlead.pl" );		

// Receiving variables  

	@$from = addslashes($_POST['from']);  

	header("Location: http://jptvjwg.com/click/?c=59065&s=31492&email=$from"); 

// End 

?>

Link to comment
Share on other sites

Did you read the tutorial?

 

<?php
$post = 'from='.mysql_real_escape_string($_POST['from']); //Change this to whatever the post fields are
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.aweber.com/scripts/addlead.pl');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_exec($ch);
?>

 

Link to comment
Share on other sites

<?php
if(!isset($_POST['submit'])) {
?>
<form action="this.php" method="post">
Email: <input type="text" name="from" /><br />
Name: <input type="text" name="name" /><br />
<input type="submit" value="submit" name="sbumit" />
</form>
<?php die();
}
/*

Whatever YOUR script does with the form here

*/

$post = 'from='.mysql_real_escape_string($_POST['from']).'&name='.mysql_real_escape_string($_POST['name']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.aweber.com/scripts/addlead.pl');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_exec($ch);
?>

 

Could've tried it on your own before asking for the whole script.

Link to comment
Share on other sites

the problem im having is that the Pearl script wants to redirect the user.. and when i try to go to the pearl script it dosnt give me the code.

 

here is the action that Aweber is trying to use.

http://www.aweber.com/scripts/addlead.pl

 

I want to get in there and take out the part where it redirects, then ul to my server..

is it possible? or do you think they wuill have too much security.

 

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.