Forum Moderators: coopster

Message Too Old, No Replies

Send or echo form results to formmail.pl and register.php?

Need to send user imput to 2 scripts or echo

         

jolac

1:35 am on Apr 6, 2003 (gmt 0)

10+ Year Member



Hi.

I am looking for some help with a forms problem...

I have a form on my site with 10 user fields, name phone ect... this form uses /othersite/register.php and when submitted it registers users for another site not on my server via a sub domain, I need to also have the user details of this form emailed to me since this other site uses many affiliate sites like mine they can't or won't change their php just so it will also email results to me.

I have another html page which has a form that uses the formmail.pl script which gets sent to me by email and it works fine

How can I get the user variables of the first form (register.php) emailed to me as well as being submitted to the other server.

or how can I echo the user variables of my formmail.pl form into the user fields or the php form page which would then be submitted to the other server this would require the user to submit what would look like the same page 2 times... but I can live with that...

If anyone can point me in the right direction I would be grateful... I have tried the dreamweaver MM_include with no success I also tried these 2 methods below but am unsure if I am doing this right...

I put this code on the formmail.pl page only as I need it to email me first and then send the variables to the php form page which will then be submitted by the user to the other site server
-----------------------------------------------------
<?php
$username = "username";
echo ("$username prints \"username\"");
$Password = "Password";
echo ("$Password prints \"Password\"");
$RePassword = "RePassword";
echo ("$RePassword prints \"RePassword\"");
$CompanyName = "CompanyName";
echo ("$CompanyName prints \"CompanyName\"");
$address = "address";
echo ("$address prints \"address\"");
$country = "country";
echo ("$country prints \"country\"");
$countryPhone = "countryPhone";
echo ("$countryPhone prints \"countryPhone\"");
$numberPhone1 = "numberPhone1";
echo ("$numberPhone1 prints \"numberPhone1\"");
$numberPhone2 = "numberPhone2";
echo ("$numberPhone2 prints \"numberPhone2\"");
$country = "country";
echo ("$country prints \"country\"");
$email = "email";
echo ("$email prints \"email\"");
$Contact = "Contact";
echo ("$Contact prints \"Contact\"");
$Profiles = "Profiles";
echo ("$Profiles prints \"Profiles\"");
?>
-----------------------------------------------------
and I also tried....
-----------------------------------------------------
<?php
if ($HTTP_POST_VARS['action'] == 'submitted') {
print '<pre>';

print_r($HTTP_POST_VARS);
print '<a href="'. $HTTP_SERVER_VARS['PHP_SELF'] .'">Please try again</a>';

print '</pre>';
} else {
?>
<form action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'];?>" method="post">
-----------------------------------------------------
here in a nutshell is what I need to do

User submits his details using my html page with formmail.pl I get results by email ----> at the same time my html page sends user info to second html page that has php form and looks exactly the same ---> user submits this second form to other server.

Hope some one can assist or give pointers

Thanks.

Jolac

jatar_k

7:02 pm on Apr 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld jolac,

What about redisplaying the output in your formmail script? You could then you could have them submit that and it posts the info to the other server and then goes to some kind of thank you page.

jolac

8:14 pm on Apr 6, 2003 (gmt 0)

10+ Year Member



Hi Jatar

Thank for the reply, I don't think that would work as these forms are for entry to a database, i.e you can enter after you submit to the "other" server... I just want a copy of the submit details, to do this I would need to pass the user variables into the same form fields in the second page

Cant use URL string because of user spaces would show as a + sign

John Doe

My Company Name

Ect....

There must be another way, I did not think this would be hard to do but it is looking like it is very hard to pass form field variables to a new page/form

I had a suggestion from someone else --->

Why not incorporate the form-to-mailer into the PHP script? Check out this thread for information on using PHP to send email:

But this returned a parse error on line one
-----------------------------------
<?

$to = "info@mysite.com";

$subject = "Member";

$headers = "From: member@mysite.com";

$msg = "";

foreach($ POST as $key => $value) {

$msg = ucfirst(str_replace(" "," ",$key)).": "$value"\n";

}

mail($to,$subject,$msg,$headers);

?>
--------------------------------

If you have any ideas I would be grateful to hear them.

Thanks again

Jolac

[edited by: jatar_k at 8:16 pm (utc) on April 6, 2003]
[edit reason] no urls thanks [/edit]

jatar_k

8:32 pm on Apr 6, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well, the first thing is you are mixing apples and oranges to certain extent. I am also a little confused. If you put php into the formmail.pl script (given that .pl is perl) I would think it wouldn't work, it is a perl script therefore it would need perl in it.

You don't need two scripts to do this. You can do one one of two things.

Rewrite the formmail.pl scipt to do what you want it to. (you would then need to know some perl)

or

you can write a php script that does all of this. As far as building the email. You should familiarize yourself with these pages
Mail Functions [php.net]
mail() [php.net]

the headers in the above code are not quite right.
$headers = "From: member@mysite.com";
should be
$headers = "From: member@mysite.com\r\n";

It will probably work fine with only one param but it will give you problems if you add a second or more.

jolac

11:12 pm on Apr 6, 2003 (gmt 0)

10+ Year Member



Hi Jatar

Thank you for taking the time to reply.

Mabey I can do this an easier way

is it possible to just have the user details emailed to me as well as being sent to the other server, the html page which has the form has this action

<form name="info" method="post" action="http://info.theothersite.com/php/member/regist.php" onsubmit="return info_onsubmit()">

I have no access to this php script (regist.php) so I would need to add something to the html page to email me the user details

That way I would not need 2 pages at all or pass any info to another page, as it is now the user details get sent to a database on the other sites server via the script regist.php that they use.

if you know how I can have the details emailed to me that would fix my problem, once again I very much appreciate you replies.

Thank you

Jolac