tjverge Posted March 3, 2011 Share Posted March 3, 2011 if (isset($_POST['update'])) { $signature = $_POST['signature']; $type = $_POST['type']; $name = $_POST['name']; $b=0; While ($b < $i) { echo $signature[$b]."<br>"; echo $type[$b]."<br>"; echo $name[$b]."<br><br>"; $b++; }} I did echo '<pre>'; print_r($_POST); echo '</pre>'; The results are Array ( [sname] => [notes] => [signature] => Array ( [0] => 1-1 [1] => 1-2 [2] => 1-3 ) [type] => Array ( [0] => Test1 [1] => Test2 [2] => Test3 ) [name] => Array ( [0] => Testa [1] => Testb [2] => Testc ) [update] => Update ) But for some reason nothing is showing up on the screen. Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/ Share on other sites More sharing options...
Pikachu2000 Posted March 3, 2011 Share Posted March 3, 2011 Where is $i assigned a value? Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182378 Share on other sites More sharing options...
tjverge Posted March 3, 2011 Author Share Posted March 3, 2011 here is the whole page <form action="main.php?id=todaysupdate.php" method="post"> Number of Signatures: <input name="nsigs" type="text" /> <input name="submit" type="submit" value="Enter Scan" /> </form> <?php if (isset($_POST['submit'])) { echo "<form action=main.php?id=todaysupdate.php method=post> <table border=0 cellspacing=0 cellpadding=0 width=700> <tr> <td>System Name: </td> <td><input name=sname type=text /></td> <td>Notes: </td> <td><input name=notes type=text /></td> </tr> </table><br> <table border=0 cellspacing=0 cellpadding=0> <tr> <td>Signature</td> <td>Type</td> <td>Name</td> </tr>"; $i=$_POST{'nsigs'}; $a=0; while ($a < $i) { echo "<tr> <td><input name=signature[] type=text></td> <td><input name=type[] type=text></td> <td><input name=name[] type=text></td> </tr>"; $a++; } echo "</table>"; ?> <input name="update" type="submit" value="Update" /> </form> <?php } if (isset($_POST['update'])) { $signature = $_POST['signature']; $type = $_POST['type']; $name = $_POST['name']; $b=0; While ($b < $i) { echo $signature[$b]."<br>"; echo $type[$b]."<br>"; echo $name[$b]."<br><br>"; $b++; }} ?> Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182382 Share on other sites More sharing options...
Pikachu2000 Posted March 3, 2011 Share Posted March 3, 2011 According to the print_r() you posted, $i has no value. If you have error reporting on, you should be getting an undefined index warning regarding that. Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182386 Share on other sites More sharing options...
tjverge Posted March 3, 2011 Author Share Posted March 3, 2011 I'm at a lost then, because it has a value as it does show the right number of rows in the form (in this cause 3). How do I get the value to transfer to the array? Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182387 Share on other sites More sharing options...
Pikachu2000 Posted March 3, 2011 Share Posted March 3, 2011 You aren't passing it with the subsequent form submission, so it loses its value. Add the lines indicated by my comments in the code and try it again. . . . [sNIP] . . . </tr>"; $a++; } echo "<input type=\"hidden\" name=\"nsigs\" value=\"{$_POST['nsigs']}\">"; // <---- ADD THIS LINE echo "</table>"; ?> <input name="update" type="submit" value="Update" /> </form> <?php } if (isset($_POST['update'])) { $i = $_POST['nsigs']; // <---- ADD THIS LINE $signature = $_POST['signature']; $type = $_POST['type']; . . . [sNIP] . . . Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182392 Share on other sites More sharing options...
tjverge Posted March 3, 2011 Author Share Posted March 3, 2011 ok that makes sense now thank you Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182393 Share on other sites More sharing options...
tjverge Posted March 3, 2011 Author Share Posted March 3, 2011 I can't mark the post as solved for some reason, can someone else do that? Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182395 Share on other sites More sharing options...
Pikachu2000 Posted March 3, 2011 Share Posted March 3, 2011 The recent forum upgrade hosed the 'Marked Solved' mod, but it's being looked into . . . Quote Link to comment https://forums.phpfreaks.com/topic/229492-results-from-echo-not-showing/#findComment-1182396 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.