Reply to Re: Submit a form & go to the new page after validate

Your name:

Reply:


Posted by Captain Paralytic on 07/13/07 08:40

On 13 Jul, 03:44, kelvin <kelvin...@yahoo.com.cn> wrote:
> Hi,
>
> A difficult question.
>
> I have a form that I used to submit tohttps://www. paypal.com/cgi-bin/
> webscr
> <form action="https://www. paypal.com/cgi-bin/webscr" method="post">
>
> Now I need to validate some inputs of this form, so I submit it to a
> PHP page in my own server first.
> <form action="paypal_upgrade_checking.php" method="post">
>
> After validate, I need to submit the form again tohttps://www.
> paypal.com/cgi-bin/webscr
> I write a piece of PHP code but it failed. The browse is still in
> paypal_upgrade_checking.php, it doesn't go to the new page.
> I wonder whether there is a way to do it.
>
> <?
> ...
> $buf = '';
>
> $req = '';
>
> foreach ($_POST as $key => $value) {
> $value = urlencode(stripslashes($value));
> $req .= "&$key=$value";
> }
>
> $header="";
> $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
> $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
> $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
> $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
>
> if (!$fp) {
> // HTTP ERROR
> print "HTTP ERROR<br/>$errno<br/>$errstr";
> exit();
> } else {
> fputs ($fp, $header . $req);
> while(!feof($fp)) {
> $buf.=fgets($fp,1024);
> }
> fclose($fp);
> echo $buf;
> }
> ?>
>
> Thank you
> Kelvin

This code will cause the sver to communicate with paypal, it won't
affect the browser.

You could send the form to the clinet and send an onload() script to
automatically submit it.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация