noobdood Posted May 20, 2014 Share Posted May 20, 2014 (edited) hey guys so im trying to display data into text boxes that are fetched from database according to checkbox with value id.processing is located before <!DOCTYPE html>: if(isset($_POST['edit_event']) && isset($_POST['check'])) { require "connection.php"; foreach ($_POST['check'] as $edit_id) { $edit_id = intval($GET['event_id']); //i tried (int)$edit_id; $sqls = "SELECT event_name,start_date,start_time,end_date,end_time,event_venue FROM event WHERE event_id IN $edit_id "; $sqlsr = mysqli_query($con, $sqls); $z = mysqli_fetch_array($sqlsr); { } button and form opens: <form method="post" action="event.php"> <input type="submit" name="edit_event" value="Edit Event"> this is the html where the data will be echoed: <div id="doverlay" class="doverlay"></div> <div id="ddialog" class="ddialog"> <table class="cevent"> <thead><tr><th>Update Event</th></tr></thead> <tbody> <tr> <td> <input type="text" name="en_" value="<?php echo $z['event_name']; ?>"> </td> </tr> <tr> <td> <input type="text" name="dates_" value="<?php echo $z['start_date']; ?>"> <input type="text" name="times_" value="<?php echo $z['start_time']; ?>"> </td> </tr> <tr> <td><input type="text" name="datee_" value="<?php echo $z['end_date']; ?>"> <input type="text" name="time_" value="<?php echo $z['end_time']; ?>"> </td> </tr> <tr> <td><input type="text" name="ev_" value="<?php echo $z['event_venue']; ?>"> </td> </tr> <tr> <td><input type="submit" name="update" value="Update Event" id="update"> <input type="submit" id="cancelupdate" name="cancel" value="Cancel" > </td> </tr> </tbody> </table> </div> this is the part which is populated by data from database where isset($_POST['check']) gets the 'check' from: echo "<tr> <td><input type='checkbox' name='check[]' value='$id'>$name </td> </tr>"; </form> thanks in advance! Edited May 20, 2014 by noobdood Quote Link to comment https://forums.phpfreaks.com/topic/288612-display-data-taken-from-database-into-text-boxes/ Share on other sites More sharing options...
noobdood Posted May 20, 2014 Author Share Posted May 20, 2014 (edited) crap forgot. the problem is i get warning: <br /><b>Notice</b>: Undefined variable: z in <b>C:\Xampp\htdocs\EMS2\event.php</b> on line <b>271</b><br /> i cant c where/what i need to edit. Edited May 20, 2014 by noobdood Quote Link to comment https://forums.phpfreaks.com/topic/288612-display-data-taken-from-database-into-text-boxes/#findComment-1480118 Share on other sites More sharing options...
loveme Posted May 20, 2014 Share Posted May 20, 2014 Get the value by row statement $row=mysql_fetch_array($se_sql); $name=$row['S_Name']; Put the value in input box as value='<?php echo $tamil;?> Quote Link to comment https://forums.phpfreaks.com/topic/288612-display-data-taken-from-database-into-text-boxes/#findComment-1480124 Share on other sites More sharing options...
noobdood Posted May 20, 2014 Author Share Posted May 20, 2014 (edited) loveme, ive tried that it didnt work either. is it because the table is hidden? because <div id="doverlay" class="doverlay"></div> <div id="ddialog" class="ddialog"> are handled in js where they show the html table when <input type="submit" name="edit_event" value="Edit Event"> is clicked and hidden when <input type="submit" name="update" value="Update Event" id="update"> or <input type="submit" id="cancelupdate" name="cancel" value="Cancel" > is clicked. Edited May 20, 2014 by noobdood Quote Link to comment https://forums.phpfreaks.com/topic/288612-display-data-taken-from-database-into-text-boxes/#findComment-1480126 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.