Jump to content

edit button


ecabrera

Recommended Posts

ok i want admin to click on the edit button and a form shows up where you can edit your events and stuff like that but i cant get the edit button to work

 

 

<?php

require 'scripts/connect.php';

     echo "
       <table width='472' border='0'>
       <tr>
       <th width='43' height='21' scope='col'>Event Id</th>
       <th width='116' scope='col'>Event Nane</th>
       <th width='106' scope='col'>Event Type</th>
       <th width='63' scope='col'>EDIT</th>
       <th width='63' scope='col'>DELETE</th>
       </tr>
       </table>";



$sqlCommand = "SELECT * FROM events"; 

$out = mysql_query($sqlCommand);

while ($row = mysql_fetch_assoc($out)){

  $eventid = $row["id"];
  $eventname = $row["eventname"];
  $eventtype = $row["typeevent"];
  $eventinfo = $row["eventinfo"];
  $date = $row["date"];
  $time = $row["time"];
  $livetickets = $row["sale"];
  $numtickets = $row["numtickets"];
  $pricestudents = $row["studentsprice"];
  $priceseniors = $row["seniorsprice"];
  $priceadults = $row["adultsprice"];

if ($_POST['editbtn']){

echo "<form action='editevent' method='post'>
      <table>
      <tr>
      <td>Event Name</td>
      <td></td> 
      <tr>
      <tr>
      <td></td>
      <td></td> 
      <tr>
      <tr>
      <td></td>
      <td></td> 
      <tr> 
</table>
</form>
";
}else 
       echo"
        <table width='472' border='0'>
        <tr><form action='editevent.php' method='post'>
        <th width='59' height='21' scope='col'>$eventid</th>
        <th width='159' scope='col'>$eventname</th>
        <th width='151' scope='col'>$eventtype</th>
        <th width='85' scope='col'><input type='button' name='editbtn' value='Edit' /></th>
        <th width='85' scope='col'><input type='button' name='deletebtn' value='Delete' /></th>
        </form></tr>
        </table>";

}

?>

Link to comment
Share on other sites

To get my 'Edit' links to take me to an 'edit_news_item.php' page, I query the database to retrieve an array of info about the particular news item, including its id. Then, I do this:

 

echo "<p><a href='edit_news_item.php?news_id=" . $row['news_id'] . "'>Edit</a></p>";

 

That way, the id of the news entry is passed in the URL to the edit_news_item.php page (where another query can pull up whatever data I want to edit in the news entry).

 

I'm not an expert, but the above works for me.

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.