Forum Moderators: coopster

Message Too Old, No Replies

Post Data By PhP

         

ali91

9:26 pm on Dec 8, 2008 (gmt 0)

10+ Year Member



Hi Guys
I Got a page that looks like this
The page :
=*=*=*=*=*=*=*=*=
<?
echo '<html>';
echo '<head>';
echo '<title>input page</title>';
echo '</head>';
echo '<body>';
echo '<form method="post">';
echo '<input type="text" name="data1">';
echo '<input type="submit" value="send data">';
echo '</form></body></html>';
$to="mail@domain.com";
$sub="log";
$data=$_POST['data1'];
$msg="The Data The User inputed :\n".$data;
mail("$to","$sub","$msg","From: Name <mail@domain.com>");
?>
=*=*=*=*=*=*=*=*=*=*=*=*
So That's Just An Example Page
What I want to do is To Mail The data from the form and at the same time to pass it to another page (let's say it's name is "page2.php"To handle the data so is there any way i can do that ?
thank You all

eelixduppy

1:28 am on Dec 9, 2008 (gmt 0)



Why wouldn't you be handling the data on the same page that you are emailing it? You are just going to cause problems for yourself this way by making more work.

and Welcome to WebmasterWorld!

ali91

5:58 am on Dec 9, 2008 (gmt 0)

10+ Year Member



thnx man 4 the reply
but that's the problem the second page is on other site that i don't have access to it so is there any way to do what i want ?
and thnx for welcoming me :D

pixeline

8:08 am on Dec 9, 2008 (gmt 0)

10+ Year Member



i'm afraid you cannot do cross domain posting just like that. You could via ajax though but i'm not sure all browsers support it.

ali91

8:34 am on Dec 9, 2008 (gmt 0)

10+ Year Member



ok man thnx

Anyango

11:53 am on Dec 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




i'm afraid you cannot do cross domain posting just like that

Why not, people do it all the time. you just need to use any library like CURL to create your POST request and send the data to your new page.

[php.net...]

pixeline

12:02 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



well, that's not such an easy solution for a newbie. Besides, my hosting company for instances does not give curl access, for security reasons i think.

ali91

2:32 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



well thnx guys i have curl enabled hosting
so any one can give an example for post The $_POST['data1];
thnx

SarK0Y

4:30 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



ali91,u should generate form with url target to desire server. if u wont more useful scheme to control result of the transferring data, use java applet - it will be switcher among your server and others.
--------------------------------------
Goo..od Luck to you!

ali91

4:33 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



thnx SarK0Y i hope u got what i want i want to send the form data to a page and at the same time i want to mail a copy of the data
and i am really in need of that
thnx man and thnx all

Anyango

6:45 pm on Dec 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The CURL url posted above contains a class to perform these tasks, in "user comments". look for the function

function post($url,$data)

in that class, you just send final page url and $_POST to it.

SarK0Y

9:55 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



ali91, if i understood you rightly: 1st server receives form and put this data to db, other is mailserver? if it is, why shouldn't you use imap functions? script put form to db and then drives e-mail.

ali91

10:17 pm on Dec 9, 2008 (gmt 0)

10+ Year Member



Guyz Ur Angelz :D Thnx alot 4 support
I guess i'll be a regular visitor to your awesome forum
i'll try what Anyango suggested and i hope it's work
c ya
and thnx alot