Re: Using PHP to reload a page w/variable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I understand what you're trying to do correctly, I would have the form
action come back to the same page, where verification is done.  At the top,
you could have a big "if the page has been submitted, execute this code"
section where it does verification of the data.  If the data is ok, it can
display a simple "Registration Confirmed.  Click here to log in." kind of
message, which then takes them on to the next stage (presumably, logging
in).  In the form, I would write the form tags like this:

<input type=password name=regpassword value="<?php echo
$_POST['regpassword']; ?>">
<input type=text name=regusername value="<?php echo $_POST['regusername'];
?>">
etc.

If the value is empty, then it just doesn't get filled in (as in the first
iteration through the page).  On the second iteration through the page, if
there is an error, it would fill in the values that were originally entered
(you could put some logic in to not fill in certain fields, if you wish) and
the person needs only change the missing or incorrect values with everything
else still filled in.

In order to get the little messages, you could include a variable in your
error-checking section which sets a variable which is read just
above/below/wherever the form fields.

<?php
    if($passworderror == 1)
    {
        echo "<font color=red>Please make sure your password is 6
characters</font>";
    }
?>
<input type=password name=regpassword value="<?php echo
$_POST['regpassword']; ?>">

Or something along those lines.

Hopefully I understood what you were asking correctly. :)

(V)

----- Original Message ----- 
From: "Roderick Martin" <rmartin@mail.state.il.us>
To: "'PHP Help Desk'" <php-windows@lists.php.net>
Sent: Wednesday, November 19, 2003 2:37 PM
Subject:  Using PHP to reload a page w/variable.


> I'm finding it hard to believe this is as difficult as it appears, but
> everywhere I search indicates that what I want to do is not an easy
> task.
>
> How do you code this?
>
> You have a user signup page and the user fills it out, filling out two
> password fields to ensure they typed it in properly and hit Submit.
>
> How in PHP do you evaluate the password strings (or other strings like
> checking email for a valid email address) and if something is wrong,
> reload the page.
>
> In my case, I have one page that does multiple things and I pass
> variables to determine what parts of the page load, so ideally, I'd
> like to reload the page and pass a variable so I can reveal some text
> like "Please retype your password".
>
> Is it really as difficult as some sites make it out to be? It seems to
> be a pretty common thing to do.
>
> Thanks!

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux