Jump to content

display data taken from database into text boxes


noobdood

Recommended Posts

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!

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.