|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm using PHP to send variables to another page using a simple <input type="text" name="whatever" size=60"> input tag. However, when the info in that is transferred to the next page (to show what the user has entered), if it's too long, instead of wrapping the code on the second page, it keeps going and completely screws up the page. What can I do to make if wrap on the second page?
|
|
#2
|
|||
|
|||
|
if (strlen($mystring) > 40) {
$firstline = substr ($mystring, 0, 40); $nextline = substr ($mystring, 40, 80); } echo" $firstline<br>$nextline"; Use that basic concept but with a while loop. (The above won't work) |
|
#3
|
|||
|
|||
|
I apologize for this... but could you give me more information on a "while" loop?
![]() -Colin Anderson |
|
#4
|
|||
|
|||
|
while ($length > $mylength) {
$do_stuff } In this case as long as $length is less than $mylength $do_stuff will continue to happen, be it once, twice, a million times. Take a look at http://www.php.net/manual/control-structures.while.php So you would want a while loop. Somthing like: $length = 40; // How much on a line $end = 0; //start point while (strlen($mystring) > $length) { $line = substr ($mystring, $start, $end); $start = $start + $length; $end = $end + $length; echo" $line"; } But no gaurentees that that 1)works or 2) is the easiest way. But thats close to what I would do. ------------------ Ripped_edge ----------- Senior Web Content Engineer VP General Obfuscation VP World Domination Division ------------- |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Form formatting - wrapping the data |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|