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!

Edited by noobdood
Link to comment
Share on other sites

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 by noobdood
Link to comment
Share on other sites

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 by noobdood
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.