Re: [PHP] PHP form port
either do this $your vars = value include process.php; or header process.php?your_var=valueyour other stuff; or $url = http://www.yourserver.com/process.php?your_var=valueetc; $contents = file($send); This will execute your php file and return into $contents the html that is outputed. You don't need to use the html if you don't want to. John Wards SportNetwork.net - Original Message - From: Daniel Guerrier [EMAIL PROTECTED] To: php user group [EMAIL PROTECTED] Sent: Saturday, August 10, 2002 5:14 PM Subject: [PHP] PHP form port How do i execute a form post with php? I want to validate CCard info etc.. then perform the post with no furtheraction from the user. Basically If not valid stay here and show whats wrong ELSE post form to process.php __ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP form port
From: Daniel Guerrier [EMAIL PROTECTED] Sent: Saturday, August 10, 2002 12:14 PM Subject: [PHP] PHP form port How do i execute a form post with php? I want to validate CCard info etc.. then perform the post with no furtheraction from the user. Basically If not valid stay here and show whats wrong ELSE post form to process.php Sorry, I mis-understood your question. PHP is server-side, so you have to post the form to validate. The way I handle the situation you have is to have the same script process the form for both the initial request (method=get) and the form post (method=post). If 'POST' == $_SERVER['REQUEST_METHOD'], then validate. If validation passes, process the transaction, and redirect with header() to a new page. if it fails, make use the prior supplied data in input values so you retain the input from the person using your form. Example: ?php if ('GET' == $_SERVER['REQUEST_METHOD']) $name=''; $location=''; } if ('POST' == $_SERVER['REQUEST_METHOD']) { $errors = validate(); if (empty($errors()) { process_form(); redirect(); } $name = trim($_POST['name']); $location = trim($_POST['location']); } ? form method=post action=?php echo {$_SERVER['PHP_SELF']}; ? input type=text name=name value=?php echo $name; ? input type=text name=location value=?php echo $location; ? input type=submit name=submit value=Submit /form HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP form port
On Sat, Aug 10, 2002 at 09:14:03AM -0700, Daniel Guerrier wrote: How do i execute a form post with php? I want to validate CCard info etc.. then perform the post with no furtheraction from the user. Basically If not valid stay here and show whats wrong ELSE post form to process.php Don't. Put the whole procedure into one script. In the first step, do the validation, if it's bad, tell the people so and exit. If it's okay, continue the processing. This will make things easier to control and work reliably. Forwarding post information can lead to a variety of difficulties such as strange behavior when people hit the back button, odd timeouts, let alone, people could play games and go directly to process.php without doing the validation step... among other things. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php