Click to See Complete Forum and Search --> : Pass or Echo form values to new form fields ?


jolac
04-05-2003, 08:44 PM
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

AdamGundry
04-06-2003, 03:56 AM
Why not incorporate the form-to-mailer into the PHP script? Check out this thread for information on using PHP to send email:

http://forums.webdeveloper.com/showthread.php?s=&threadid=6989

Adam

jolac
04-06-2003, 05:21 AM
Hello in Cornwall

Thanks for the reply...

I tried this php but I am getting a parse error, I also tried <?php rather than <? on line one but that got the same error...

Parse error: parse error in /usr/local/plesk/apache/vhosts/mywebsite.com/httpdocs/refer.php on line 1

I don't get this as the script seems fine to me...
-------------------
<?



// address the email will be sent to (change the address between quotes)

$to_=_"info@mywebsite.com";



// message subject (change only what is between quotes)

$subject_=_"Member Email";



// replace you@yourdomain.com with the email you want to be

// shown as the sender

$headers_=_"From: member@mywebsite.com";



// don't modify anything below this line



$msg_=_"";



foreach($_POST_as_$key_=>_$value)_{

___$msg_.=_ucfirst(str_replace("_",_" ",_$key))_._": "_._$value_._"\n";

}



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



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

I appreciate your trying to help, do you have any idea what the problem could be, your method was a good idea and i think it should work ok... but the parse error I don't understand.

Thank you

Jolac

AdamGundry
04-06-2003, 10:49 AM
Are those underscores in the file? Shouldn't they be spaces?

I'm afraid I can't really help you, as I'm only beginning to learn PHP. You could try the forums over at http://www.phpbuilder.com/.

Adam

jolac
04-06-2003, 02:58 PM
Hi. Adam

I tried it without the underscores, but no joy... you would think that whoever posted this code would make sure that it works and is correct, but I suppose not it has been a waste of time thus far.

But thanks for your help, I do appreciate it

Jolac
------------
<?

$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);



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