0

i am fetching data in text fields and then trying to update it like this then in the bottom this is what i'm doing

<?php                      
    $query= mysqli_query($connect,"SELECT * FROM page");
    while ($row = mysqli_fetch_assoc($query))
    if(isset($_GET['edit'])){?>
    <h1>About us </h1>
    <form >
        <div class="form-group"><textarea class="form-control" rows="10" name="con"><?php echo   $row['content'] ?></textarea></div>;
        <div class="form-group"> <strong>Projects Completed :</strong><input type="text" class="form-control" name="progress" value= "<?php echo $row['projects_completed']?>" ></div>
        <div class="form-group"> <strong>Projects In Progress :</strong><input type="text" class="form-control" name="done" value="<?php echo $row['projects_running']?>"> </div>        
        <a class="btn btn-primary"   href="about-us.php?update">Update</a>
    </form>
    <?php 
        }

    else{?>
        <a  class="btn btn-default pull-right" href="about-us.php?edit" name="edit">Edit</a>
        <h1>About us </h1>
        <?php 
            echo '<p>'.$row['content'].'</p>';
            echo  '<p><strong>Projects Completed :</strong>' .$row['projects_completed'].'</p>';
            echo  '<p> <strong>Projects Completed :</strong>' .$row['projects_running'].'</p>';
        ?>
    <?php };


?>

<?php if (isset($_GET['update'])) {
      $name= $_GET['content'];
      echo $name; 
?>

this is the error i get

Notice: Undefined index: content in C:\wamp\www...

Please help me to fix this ,

Sikander
  • 2,799
  • 12
  • 48
  • 100

1 Answers1

0

The notice messsage you see says that the array $_GET has not a content index. You can do something like that:

if (key_exists('content', $_GET)) {...} else {...}

instead of

if (isset($_GET['update'])) ...
ccosta
  • 86
  • 4