Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:38:58+00:00 2026-06-10T20:38:58+00:00

Am fairly new to PHP and am making a basic CRUD style management system.

  • 0

Am fairly new to PHP and am making a basic CRUD style management system. I Have an update page and it displays data from a News table, and populates a form with it. The current picture ?(reference) is pulled through and displayed on the form. However if a user wants to change the picture they can press a ‘delete’ button and then I have written some PHP to display a upload button, set the values in the database for the image to null and hide the delete button, allowing the user to upload a new picture.

The Delete button only removes the reference (path) to the picture from the database, it doesn’t delete the actual picture.

This is the HTML control to show the image and delete button. It also shows how the delete button works:

 <td align="right">Image 1:</td>
 <td align="left"><img src="uploads/newsimages/<?php echo $row["Image"]; ?>" width="230" border="0">&nbsp;<a href="UpdateNews.php?change=imagex&cid=<?php echo $row["NewsID"]; ?>">delete</a></td>

As you can see, when clicked it sets change=imagex and cid= the current news id.

There is then an if statement I have written, but it doesn’t seem to only get activated when the delete button is clicked. Because I always get an error that ‘cid’ is undefined. It is as follows:

<?php
if (isset($_GET['change'] = "image1") {
    $query = "UPDATE  Table_Name SET Image = '' WHERE NewsID =".$_GET['cid']." ";
}

?>

I am pretty sure my lack of PHP knowledge is letting me down and I am trying to go about this the wrong way, because however I alter the if statement it always gives me an error. First it was cid is undefined so I changed to id but i already use that for something else, another query/function. I hope that all amde sense, can anyone tell me where Im going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:38:59+00:00Added an answer on June 10, 2026 at 8:38 pm

    You are missing a parenthesis + you have to specify individually:

    if (isset($_GET['change'] = "image1") {
    

    Change to:

    if (isset($_GET['change']) && $_GET['change'] == "image1") {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to php and mysql but I have created a small
I am fairly new to PHP OOP, the problem that I am have is
I am fairly new to PHP, but have applied my previous knowledge of programming,
I'm fairly new to HTML, PHP, CSS and Javascript. I do have a bit
I am fairly new to php and have not figured out how I would
I'm fairly new to PHP so I have a small problem as I'm learning:
I'm fairly new to PHP, but have managed to set up a script that
I'm fairly new to PHP and have been using PHP's readdir() to look into
I am fairly new to PHP. I have a function which checks the cost
I am fairly new to php but I have an index file in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.