mar92 Posted October 11, 2015 Share Posted October 11, 2015 (edited) Hello, I create PHP/Mysql table that consist of 6 column.I want to make the column grade as select input of A,B,C,D to the database and i want to add select input to the Add it column .I tried several way but didn't know How ? <?php // build SELECT query $query = "SELECT * FROM study"; // Connect to MySQL if ( !( $database = mysql_connect( "localhost", "gjk", "hj" ) ) ) die( "Could not connect to database </body></html>" ); // open database if ( !mysql_select_db( "adv", $database ) ) die( "Could not open database </body></html>" ); // query database if ( !( $result = mysql_query( $query, $database ) ) ) { print( "<p>Could not execute query!</p>" ); die( mysql_error() . "</body></html>" ); } // end if mysql_close( $database ); ?><!-- end PHP script --> <table> <caption>Results of "SELECT <?php print( "$select" ) ?> "</caption> <tr> <th> </th> <th>Code</th> <th>Title</th> <th>cr</th> <th> prerequisite</th> <th>Addit</th> <th>Grade</th> <tr> <?php // fetch each record in result set while ( $row = mysql_fetch_row( $result ) ) { // build table to display results print( "<tr>" ); foreach ( $row as $value ) print( "<td>$value</td>" ); print( "</tr>" ); } // end while ?><!-- end PHP script --> </table> <p>Your search yielded <?php print( mysql_num_rows( $result ) ) ?> results.</p> </body> </html> Edited October 11, 2015 by mar92 Quote Link to comment https://forums.phpfreaks.com/topic/298535-create-select-and-checkbox-input-for-php-mysql-table/ Share on other sites More sharing options...
Ch0cu3r Posted October 12, 2015 Share Posted October 12, 2015 I want to make the column grade as select input of A,B,C,D to the database and i want to add select input to the Add it column Your post is not very clear. Are you saying you are wanting to create a dropdown menu, containing the options A to D, for the "Add it" column in your HTML table? Then to be able to update your database with the selected values from the dropdown menus? Quote Link to comment https://forums.phpfreaks.com/topic/298535-create-select-and-checkbox-input-for-php-mysql-table/#findComment-1523003 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.