Thanks, I'll review this.
"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:gv8kuvoa3pullv0oa5lrlr1tqvi8i6r9qi@4ax.com...[color=blue]
> I noticed that Message-ID: <RRoGb.10873$JD6.5055@lakeread04> from TJ
> contained the following:
>[color=green]
> >Dear PHP group,
> >
> >First question:
> >
> >I have an input form that upon pressing a button validates the values
> >entered into this form. I am using the following code recall this form if
> >there is an error in one of the requested fields:
> >
> ><form name="form1" method="post" action= "InputForm.php" >
> >
> >All works fine. However, if there is an error and this form is recalled,[/color][/color]
all[color=blue][color=green]
> >the fields are blanked out when you are brought back to the form. I'd[/color][/color]
like[color=blue][color=green]
> >for the form to retain the values that had been entered. How do I do[/color][/color]
this?[color=blue][color=green]
> >
> >Second question:
> >
> >For the fields that are in error, I'd like for the titles for the fields[/color][/color]
to[color=blue][color=green]
> >display an asterisk and change the text to red. Have any of you done this
> >and if so how do you implement it?
> >[/color]
> Check this out - it simply checks if the field has been entered or not.
> If the form is resubmitted it repopulates the textfields with the $_POST
> variables.
>
> <html>
> <head>
> <title>Check fields</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <style type="text/css">
> <!--
> .red { color: #FF0000}
> -->
> </style>
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <?php
> function error($field){
> if (!$field && $_POST["Submit"]){
> print"<p class=\"red\">* ";
> }
> else{
> print"<p>";
> }
> }
> ?>
> <form name="form1" method="post" action="">
> <?php
> error($_POST["textfield"]);
> ?>
> First name <input type="text" name="textfield" value="<?php print
> $_POST["textfield"];?>">
> </p>
> <?php
> error($_POST["textfield2"]);
> ?>
> Last name <input type="text" name="textfield2"value="<?php print
> $_POST["textfield2"];?>"></p>
> <p>
> <input type="submit" name="Submit" value="Submit">
> </p>
> </form>
> </body>
> </html>
>
> --
> Geoff Berrow (put thecat out to email)
> It's only Usenet, no one dies.
> My opinions, not the committee's, mine.
> Simple RFDs
http://www.ckdog.co.uk/rfdmaker/[/color]