>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.

  $errors = validate();
  if (empty($errors()) {
 $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">


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to