discussnow Posted October 29, 2008 Author Share Posted October 29, 2008 still getting a line 23 error Quote Link to comment Share on other sites More sharing options...
bobbinsbro Posted October 29, 2008 Share Posted October 29, 2008 move the echo implode() inside the if(isset()) block. you can't call a variable that wasn't yet defined, and $store only gets defined once a user submits the form (which is when the contents of the if(isset()) block execute). Quote Link to comment Share on other sites More sharing options...
discussnow Posted October 30, 2008 Author Share Posted October 30, 2008 Its working now, however, it seems to keep repeating itself almost like the loop isn't stopping. Also the first array entry is repeated twice Quote Link to comment Share on other sites More sharing options...
bobbinsbro Posted October 30, 2008 Share Posted October 30, 2008 i'm not sure what your code looks like, but this is built off of yours and it works: <html> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <title> Paragraph Scrambler </title> <body> Paste Paragraph <br> <textarea name="para" type="text" row="5" col="5"></textarea><br> <input name="send" type="submit" value="Submit!"> <input type="reset" value="Cancel"><br /> <?php if(isset($_POST['para'])){ $para = $_POST['para']; $result = split('\.|\?',$para); $loopCount = count($result); for($i = 0; $i < $loopCount; $i++){ if (($i % 2) == 0){ $store[] = $result[$i]; } } echo implode(".",$store); } ?> </body> </html> 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.