nicx Posted June 7, 2008 Share Posted June 7, 2008 All php master. I want to ask something about sintax php. My question: i have a form and it contains 160 character,user usually add less than 160 . How the sintax php to auto complete to 160 char with space, if user add less than 160?? Plz help. Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/ Share on other sites More sharing options...
nicx Posted June 7, 2008 Author Share Posted June 7, 2008 Please help me.Write down the php sintax to auto complete chars with space in a form here.,thanks b4 Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-559743 Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 So if someone entered "abcde" into a form, you want 155 spaces added? Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-560075 Share on other sites More sharing options...
keeB Posted June 8, 2008 Share Posted June 8, 2008 <?php // $input contains user input function add_whitespace($input) { Â Â $zeros = 160 - str_len($input); Â Â $buf = ""; Â Â for ($x=1,$x<$zeros;$x++) { Â Â Â $buf = $buf . " "; Â Â } Â Â return $input . $buf; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-560521 Share on other sites More sharing options...
nicx Posted June 9, 2008 Author Share Posted June 9, 2008 Thanks all. But im confused to fusion that. This my form:  <?php  echo "Text:<br />   <textarea name=\"message\" maxlenght=\"160\"></textarea><br/>"; ?>  how to fusion with keeB script?? Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-560945 Share on other sites More sharing options...
nicx Posted June 9, 2008 Author Share Posted June 9, 2008 <?php // $input contains user input function add_whitespace($input) {   $zeros = 160 - str_len($input);   $buf = "";   for ($x=1,$x<$zeros;$x++) {    $buf = $buf . " ";   }   return $input . $buf; } ?> how with this: <?php  echo "Text:<br />   <textarea name=\"message\" maxlenght=\"160\"></textarea><br/>";  // $input contains user input  function add_whitespace($message) {   $zeros = 160 - str_len($message);   $buf = "";    for ($x=1,$x<$zeros;$x++) {    $buf = $buf . " ";   }    return $message . $buf; }  ?>  only changes $input to $message ?? Thats true? Plz keeB answer plz hehe Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-560948 Share on other sites More sharing options...
nicx Posted June 9, 2008 Author Share Posted June 9, 2008 I was write the keeB scrite to my file,but the warning: Parse error : syntax error, unexpected ')', expecting ';' in /home/nicx/public_html/dir/ form.php on line 41  @keeB,your sintax have some mistake? Plz give the right sintax! Thans Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-560998 Share on other sites More sharing options...
keeB Posted June 9, 2008 Share Posted June 9, 2008 <?php // $input contains user input function add_whitespace($input) { Â Â $zeros = 160 - str_len($input); Â Â $buf = ""; Â Â for ($x=1;$x<$zeros;$x++) { Â Â Â $buf = $buf . " "; Â Â } Â Â return $input . $buf; } ?> Â d'oh. Updated. Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-561148 Share on other sites More sharing options...
nicx Posted June 10, 2008 Author Share Posted June 10, 2008 Ok,master i will try it Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-561646 Share on other sites More sharing options...
nicx Posted June 10, 2008 Author Share Posted June 10, 2008 Master keeB,i was try but it cant work. Hmm..I confused. Plz any other sintax? Quote Link to comment https://forums.phpfreaks.com/topic/109119-helpauto-complete-chars-in-a-form/#findComment-561832 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.