chrisredding Posted February 11, 2007 Share Posted February 11, 2007 Hi, I have a script that checks and submits a contact form. It all works fine, but I have a small niggle... Each input field has some PHP to set it's default value, so that if the user submits the form and one or more of the fields is rejected for some reason, and the form refreshes, the fields retain their default values. This works fine on the 'input' fields, but doesn't work on the 'textarea'. You can take a look at the form here: http://www.chrisredding.com/v4/gen/form/contact.php The code for this problem area is below: <fieldset id="fieldset"> <label for="comments">Message : </label> <textarea name="comments" id="comments" type="text" class="textb" tabindex="40" cols="40" rows="10" value="<?php echo $_POST['variable'];?>"/> </textarea> </fieldset> So if the user fills in their name, email and a message, but gets the CAPTCHA code wrong for instance, their message disappears. Which would annoy the hell out of me! But their name and email remain as they have filled them in. Any idea why this might be? I've included the code for one of the fields that does work here: <fieldset id="fieldset"> <label for="email">Email : </label> <input name="email" id="email" type="text" class="textb" tabindex="1" value="<?php echo $_POST['variable'];?>" size="30"/> <br /> </fieldset> (I've hidden my variable names!) Many thanks, Cheers Chris Quote Link to comment Share on other sites More sharing options...
Yesideez Posted February 11, 2007 Share Posted February 11, 2007 <textarea name="comments" id="comments" type="text" class="textb" tabindex="40" cols="40" rows="10" /><?php echo $_POST['variable'];?></textarea> Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 11, 2007 Share Posted February 11, 2007 This is the second time in 24 hours I've said this: Textarea's don't have value=""! The content goes between the two textarea tags! Quote Link to comment Share on other sites More sharing options...
Yesideez Posted February 11, 2007 Share Posted February 11, 2007 I don't think "tabindex" is a W3C standard either :S Quote Link to comment Share on other sites More sharing options...
chrisredding Posted February 11, 2007 Author Share Posted February 11, 2007 Bloody hell. That was quick. And very much appreciated! I've fixed it already... Many thanks for you help. Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.