gabriellevierneza Posted February 14, 2010 Share Posted February 14, 2010 hi.. i am trying to execute and display SQL data on Submit click.. but there seems to be an error with isset($_POST["submit"] because when i delete that part, the data is displayed. please, i really need your help.. this is for my Bachelor thesis.. here is the code block.. <? $sql = "SELECT s.subj_code, s.subj_title, s.subj_unit FROM subject s LEFT JOIN curriculum c ON s.curriculum = c.curr_year WHERE s.curriculum = '2006-2007'"; $result = mysql_query($sql) or die (mysql_error()); if (isset($_POST["submit"])){ while ($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td>' . $row['subj_code'] .'</td>'; echo '<td>' . $row['subj_title'].'</td>'; echo '<td>' . $row['subj_unit'].'</td>'; echo '</tr>'; } } ?> thank you so much!! Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/ Share on other sites More sharing options...
PHP Monkeh Posted February 14, 2010 Share Posted February 14, 2010 I take it the form which is submitting this data: a) is using the POST method and b) has a field named 'submit' Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/#findComment-1012033 Share on other sites More sharing options...
gabriellevierneza Posted February 14, 2010 Author Share Posted February 14, 2010 yes it does.. but i dont know why isset doesnt work Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/#findComment-1012035 Share on other sites More sharing options...
jl5501 Posted February 14, 2010 Share Posted February 14, 2010 have you tried putting print_r($_POST) in your php, to show what you are getting? Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/#findComment-1012062 Share on other sites More sharing options...
gabriellevierneza Posted February 14, 2010 Author Share Posted February 14, 2010 have you tried putting print_r($_POST) in your php, to show what you are getting? no i havent.. i havent tried that before either.. where can i put that? Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/#findComment-1012063 Share on other sites More sharing options...
PHP Monkeh Posted February 14, 2010 Share Posted February 14, 2010 Put it anywhere on the page which is handling the form submission, as it will show you what the $_POST array contains (and so you can see if 'submit' is in there). Quote Link to comment https://forums.phpfreaks.com/topic/192017-execute-sql-and-display-data-on-submit-click/#findComment-1012169 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.