Jump to content

Recommended Posts

Hello, I am receiving an error of "Notice: Undefined variable: product_id in \edit_product_gaming.php on line 24"

 

What I tried is to simply define that via :   $product_id = $_GET['product_id'];

 

This simply led to another error that there was an undefined index of 'product_id'.

 

This is really frustrating as I had it working earlier and due to ONLY moving the file from one folder to the other(to keep everything neat), and changing the URL of the form to accommodate the new directory (even though I didn't actually need to) I started to receive this error once again, if ^that had anything to do with it please let me know, otherwise I think there must be some error in the coding.

 

Would really appreciate some help on this matter

 

Thanks! 

 

 

http://pastebin.com/656RZ7DS

Link to comment
https://forums.phpfreaks.com/topic/279890-undefined-variable-error/
Share on other sites

Does the GET variable appear in the website URL?

 

 

Note: the code should be changed to something like this:

$product_id = (isset($_GET['product_id'])) ? $_GET['product_id'] : '';

That way $product_id will always be set to something; even if the GET variable is missing.

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.