cry of war Posted July 20, 2007 Share Posted July 20, 2007 i tried to get this code to load but it doesnt want to for some odd reason anyone know why? <?php $info = $_POST["info"]; $id = $_POST["id"]; if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form ?> <html> <head> <title>Personal INFO</title> </head> <body> <form action="<?php echo $PHP_SELF;?>" method="post"> PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE TEXT AREA BELOW WHERE IT SAYS "INSERT HERE". <textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br /> ENTER ID: <INPUT TYPE="TEXT" name="id" value="id">INPUT ID HERE</INPUT> <input type="submit" value="submit" name="submit"><input> </form> <?PHP } else { $wordChunks = explode(" ", $info); for($i = 0; $i < count($info); $i++){ echo "Piece $i = $wordChunks[$i] <br />"; } } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
per1os Posted July 20, 2007 Share Posted July 20, 2007 Register_globals is probably off (the $PHP_SELF should be $_SERVER['PHP_SELF'] Make sure www.php.net/error_reporting is set to E_ALL and display_errors is on to make sure you are getting an error message if there is one. Quote Link to comment Share on other sites More sharing options...
cry of war Posted July 20, 2007 Author Share Posted July 20, 2007 Thank you that fixed it right up Quote Link to comment Share on other sites More sharing options...
cry of war Posted July 20, 2007 Author Share Posted July 20, 2007 ok not fixed now the for isnt looping??? it just stops at "Piece 0 = recon" Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted July 20, 2007 Share Posted July 20, 2007 You have some invalid HTML issues, input tags do not have closing tags. So removeclosing tags for inputs (</input>) Also your for loop needs to be this: for($i = 0; $i <= count($info); $i++){ Notice the equals sign added after the the less than sign. With the way you have it PHP will never get to the last item within loop, for example it will only loop 7 times if there was 8 items within the array. Working code: <?php // if page is not submitted to itself echo the form if (!isset($_POST['submit'])) { ?> <html> <head> <title>Personal INFO</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE TEXT AREA BELOW WHERE IT SAYS "INSERT HERE". <textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br /> ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br /> <input type="submit" value="submit" name="submit" /> </form> <?PHP } else { $info = $_POST['info']; $id = $_POST['id']; $wordChunks = explode(" ", $info); <?php // if page is not submitted to itself echo the form if (!isset($_POST['submit'])) { ?> <html> <head> <title>Personal INFO</title> </head> <body> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> PLEASE CLICK INSIDE OF THE SGW SPY LOG AREA AND PRESS CTRL+A THEN CTRL+C THEN CLICK IN THE TEXT AREA BELOW WHERE IT SAYS "INSERT HERE". <textarea rows="20" cols="20" name="info" wrap="physical">INSERT HERE</textarea><br /> ENTER ID: <INPUT TYPE="TEXT" name="id" value="INPUT ID HERE" /><br /> <input type="submit" value="submit" name="submit" /> </form> <?PHP } else { $info = $_POST['info']; $id = $_POST['id']; $wordChunks = explode(" ", $info); for($i = 0; $i <= count($info); $i++) { echo "Piece $i = $wordChunks[$i] <br />"; } } ?> 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.