Marie Posted December 24, 2011 Share Posted December 24, 2011 Hello, It seems when I try to add some space between the form field and any visible wording, I lose the form's "stickiness" and also the hints to tell people to fill out a certain field, if it has been done incorrectly. I would like my forms to look nice but can't seem to override this in CSS or in the php code. Marie. Link to comment Share on other sites More sharing options...
Antonio Conte Posted December 25, 2011 Share Posted December 25, 2011 Css is how you should alter the presentation. Something like: option { padding-left: 3px; } Should give them some space. Link to comment Share on other sites More sharing options...
Marie Posted December 26, 2011 Author Share Posted December 26, 2011 Thank you. I will give this a try but will have to get back to the forum later. Marie Link to comment Share on other sites More sharing options...
Antonio Conte Posted December 27, 2011 Share Posted December 27, 2011 Look like I rushed the explanation a bit. After the second read-through, it looks like you want to seperate the exlanatory text from the input field, like: Fill out first name: -spacing- [input field] This is how you do it: 1. Start by getting the (X)Html right. Something like <!-- Inside a <form>-tag --> <div> <label for="a-field">Explanatory text</label> <input name="a-field" type="text" title="Description for a-field" value="" /> </div> <div> <label for="another-field">Explanatory text</label> <input name="another-field" type="text" title="Description for another-field" value="" /> </div> 2. And the css: /* Align divs */ form div { float: left; width: 100%; height: 40px; clear: both; padding: 10px; } /* Align label and inputs */ form label, form input { width: 45%; line-height: 2.5; height: 30px; display: block; float: left; clear: none; } This will allow you to style the text and input fields. Change the CSS to fit your needs. Link to comment Share on other sites More sharing options...
Marie Posted March 13, 2012 Author Share Posted March 13, 2012 A slight variation to this problem. When I try to add stickiness to the text area I get an undefined variable error. Following is my code. <textarea name="comments" rows="5" cols="45" ><?php echo $comments; $PostANoticeTBR_errors; ?> </textarea> I have played around with the code and I seem to get an undefined variable no matter what I do. Marie Link to comment Share on other sites More sharing options...
Antonio Conte Posted March 13, 2012 Share Posted March 13, 2012 You need some kind of check like isset(). <textarea name="comments" rows="5" cols="45" ><?php if (isset($_POST['comments'])) { echo $_POST['comments']; } ?></textarea> That will remove the error. 1 Link to comment Share on other sites More sharing options...
Recommended Posts