phpnoobie9 Posted March 27, 2008 Share Posted March 27, 2008 If a user enters characters in a form it can stretch the screen if the user does not use a space. How can I prevent that? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 wordwrap can be of some help but really in proper xhtml syntax your containers have a defined size that will prevent string from flowing out Quote Link to comment Share on other sites More sharing options...
phpnoobie9 Posted March 27, 2008 Author Share Posted March 27, 2008 My tables have define widths and it's still stretching? Quote Link to comment Share on other sites More sharing options...
Betard Posted March 27, 2008 Share Posted March 27, 2008 he means your input tags / the fields they are inputting data.... <input type="text" name="email_addy" size="25" /> that should prevent the problem you are experiencing. tables/td tags will always stretch to their content regardless of any "set" widths you may have defined for them. Quote Link to comment Share on other sites More sharing options...
phpnoobie9 Posted March 27, 2008 Author Share Posted March 27, 2008 I forgot to add. When the user submits the data it shows on a different page. So..if a user just keeps doing this..llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll it'll stretch the page. How do I stop that? Quote Link to comment Share on other sites More sharing options...
leeandrew Posted March 28, 2008 Share Posted March 28, 2008 possibly set your main page width to a px length instead of a percentage. e.g. <table width="800">, then within the main table set widths/heights as percentage. <table width="100%">. Dont know if this will work but i'd give it a try. Quote Link to comment Share on other sites More sharing options...
Betard Posted March 28, 2008 Share Posted March 28, 2008 I forgot to add. When the user submits the data it shows on a different page. So..if a user just keeps doing this..llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll it'll stretch the page. How do I stop that? you can't really, sometimes you just have to design for typical use, and dismiss the fact that some people may do something like that. That would not be a typical situation, and as designers/coders we simply have to decide "at what point is overkill?" Do you really care what the submitted page will look like to the idiot that does that? Quote Link to comment Share on other sites More sharing options...
phpnoobie9 Posted March 28, 2008 Author Share Posted March 28, 2008 Am I able to disable form submition if the user inserts a certain amount of characters without a space? Like some kind of ereg? Quote Link to comment Share on other sites More sharing options...
Demonic Posted March 28, 2008 Share Posted March 28, 2008 Just make a function where it splits each word in an array and if there is more then one word longer then 100 characters tell them, you are trying to spam the site. Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted March 28, 2008 Share Posted March 28, 2008 Found on: http://ca3.php.net/wordwrap function layout_wrap($str, $i) { $j = $i; while ($i < strlen($str)) { if (strpos($str, ' ', $i-$j+1) > $i+$j || strpos($str, ' ', $i-$j+1) === false) { $str = substr($str, 0, $i) . ' ' . substr($str, $i); } $i += $j; } return $str; } It will wrap strings that do not contain spaces. $str is your string, and $i is the number of characters after which you want to wrap. 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.