gw32 Posted March 29, 2016 Share Posted March 29, 2016 I can't seem to understand how to do this. Can someone help? I created a form to select members and hit submit. Then I wan to ON SAME PAGE display the selected members information. {CODE} //This works echo "Select Player - ";echo "<select name='players'>"; while ($row = $result->fetch_assoc()) { unset($playersid, $name); $playersid = $row['playersid']; $name = $row['name']; echo '<option value="'.$playersid.'">'.$playersid.' - '.$name.'</option>'; }echo "$playersid";echo "</select>";echo '<font color="White"><input type="submit" value="Submit">'; // End works // THIS IS WHERE I AM STUCK$name = $_POST['name'];$playersid = $_POST['playersid'];// VARIABLES NOT PASSED //THIS IS DISPLAYEDecho '<h3 class="pos_right">Weekly Report for $name</h3>';echo '<p class="pos_right"> <table border="1"> <thead> <tr> <td align="center" width="75">Week<br>Played</td> <td align="center" width="75">Did They <br>Attend</td> <td align="center" width="75">Points</td> <td align="center" width="75">Amount<br>Paid</td> <td align="center" width="75">High<br>Hand</td> <td align="center" width="50">Fifty<br>Fifty</td> <tr> </thead>'; // SELECT PLAYER INFO FROM DATABASE //NOT WORKING, HERE. WORKS WELL IN MYSQL SQL $query = mysqli_query($conn,"SELECT b.week, a.attend, a.points, a.payout, a.hh, a.ffFROM data a, dates b, players cWHERE a.playersid = c.playersidAND a.dateid = b.dateidAND a.playersid = 12"); $res = mysqli_query( $conn, $query ) or exit( mysqli_error($conn) ); // NOTHING DISPLAYED while($row = mysqli_fetch_array($query)) { echo "<tr> <td>" . $row['week'] . "</td> <td>" . $row['attend'] . "</td> <td>" . $row['points'] . "</td> <td>$" . $row['payout'] . "</td> <td>$" . $row['hh'] . "</td> <td>$" . $row['ff'] . "</td> </tr>"; } echo "</table>"; {END CODE} This is the last script I need help with, all other 5 scripts wor well. Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/ Share on other sites More sharing options...
mac_gyver Posted March 29, 2016 Share Posted March 29, 2016 (edited) you need to have php's error_reporting set to E_ALL and display_errors set to ON in the php.ini on your development system, so that php will help you by reporting and displaying all the errors that it detects. you will save a TON of time. edit - lol, which you were already told you needed to do in your last thread. for your first problem, you will be getting undefined array index errors, since the name of your <select > form field is - 'players' you should also be using a method='get' form since the form is determining what will be gotten/displayed on the page. for your second problem, you have a variable name mismatch, between what you are storing the result from the query in and what you are using in your loop, that php would also be giving you errors for. p.s. - the forum's bbcode tags are - and can be applied by selecting the code and hitting the <> menu button. Edited March 29, 2016 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/#findComment-1532575 Share on other sites More sharing options...
gw32 Posted March 29, 2016 Author Share Posted March 29, 2016 Thanks, I'll try all suggestions. My ISP says that E_ALL and display_errors are both ON. Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/#findComment-1532588 Share on other sites More sharing options...
mac_gyver Posted March 31, 2016 Share Posted March 31, 2016 i hope you mean your web host. your isp wouldn't have anything to do with web hosting. you also should be learning and developing php code on a local development system, not an a live server at a web host. those two settings may be set somewhere to those two values, but hey are not in effect. in both of your threads you would have been getting php errors that would help you find the problems, but you are not getting the errors or they are being hidden somehow. Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/#findComment-1532635 Share on other sites More sharing options...
gw32 Posted April 1, 2016 Author Share Posted April 1, 2016 I had someone from my web host send me an example of a php.ini file which he advised me where to locate it and it works. Thanks. I would like to use a lock development host system, but for the life of me I can't understand how to setup ECLIPSE or MySQL/Apache/PHP on OS X Yosemite. Either i am too dumb or the instructions are not meant for first timers. If you know of a web site that offers instructions for either of these for beginners, I'll be very grateful. I'm learning a lot from this forum, keep up the good work. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/#findComment-1532666 Share on other sites More sharing options...
gw32 Posted April 1, 2016 Author Share Posted April 1, 2016 ERROR "lock development host system" should read "local development host system". Quote Link to comment https://forums.phpfreaks.com/topic/301109-pass-variables-from-php-mysql-form-to-php-mysql-select-while-on-same-page/#findComment-1532667 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.