Good Day I've created this edit/update form with assistants of this tutorial http://www.freewebmasterhelp.com/tutorials/phpmysql/7
And when I click the update button I get these two messages

Notice: Undefined index: artist_id in C:\wamp\www\Practical_Project\admin_artist_edit.php on line 2

Warning: mysql_numrows() expects parameter 1 to be resource, boolean given in C:\wamp\www\Practical_Project\admin_artist_edit.php on line 9

I don't understand why I'm getting an error in line 2 since I am passing in an array from another file and I just don't understand what causing the error on line 9 at all. I have attached my code below and any assistance will be appreciated :).

<?php
$id = $_GET['artist_id'];

  $conn = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
  mysql_select_db("gallery") or die ("Unable to select database");

//Getting the artist where the id match
$query = "SELECT * FROM artist WHERE artist_id = $id";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

//creating an edit form
$i=0;
while ($i<$num){
	
	$firstname=mysql_result($result,$i,"firstname");
	$surname=mysql_result($result,$i,"surname");
	$bibliography=mysql_result($result,$i,"bibliography");
	$phone=mysql_result($result,$i,"phone");
	$email=mysql_result($result,$i,"email");
	
	echo '<form action="admin_artist_edit.php" method="post">
	<td align="center"><input name="edit_id" type="hidden" value="'; echo $id; echo '"></td></br>
	<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'; echo $firstname; echo '"></td></br>
	<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'; echo $surname; echo '"></td></br>
	<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'; echo $bibliography; echo '"></td></br>
	<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'; echo $phone; echo '"></td></br>
	<strong>Email:</strong><td align="center"><input name="email" type="text" value="'; echo $email; echo '"></td></br>
	<input type="submit" value="Update">
	</form>';
++$i;
}

//when the user to submit it will update the database
if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

if (isset($_POST['submit']) && $_POST['submit'])
{
$query=mysql_query("UPDATE artist SET firstname='$edit_firstname', surname='$edit_surname', bibliography='$edit_bibliography', phone='$edit_phone', email='$edit_email' WHERE artist_id='$edit_id'
");
mysql_query($query);
echo "Record Updated";
mysql_close();
}
?>

1. To avoid the notice you need to check if the variable is set:

$id = isset($_GET) ? $_GET : null;

that means that if $_GET exists then $id equals $_GET
but this is hardly a mistake, it's just a notice

2. the function on line 10 should be mysql_num_rows NOT mysql_numrows
it is a good practice to see if your query is valid by checking for errors on line 9: $result=mysql_query($query) or die(mysql_error());

Thanks for your help. Now I am getting this error now
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

The other error I noticed is that the form method is post and your requesting the $_GET and should be $_POST;

Never mind, $_GET is for the edit.

There are two query requests, one in line 49 and one in line 50, delete line 50 to see what happens!

Also I suggest to add:

$review_update = mysql_affected_rows(); //after update query

if($review_update > 0){
 echo 'Record Updated';
} else {
 echo 'Unable to Update';
}

mysql_close();

otherwise will say Record Updated even if record is not!

I've done that and still get the error message, I've infact deleted the bottom two if statements just after the while loop and still get this message so my problem is around the top between these tags.

$query = "SELECT * FROM artist WHERE artist_id = $id";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_close();

I thought the problem was the update...

Sometimes I get that error when the variable is inside quotes... don't know why?

try changing to:

$query = "SELECT * FROM artist WHERE artist_id = ".$id.";";

to see what happens..

Yeah I've heard of that happening as well. I've tried and changed

$query = "SELECT * FROM artist WHERE artist_id = $id";

to

$query = "SELECT * FROM artist WHERE artist_id = ".$id.";";

and the same result come back :/


Plus when I echo $result and $num,

$result come back as Resource id #5
$num come back as 1.

But the funny thing is that its filling out all of the text fields with the correct variables

The error is displayed after the echo?

If so, did the first post has a submit button named 'submit'?

Then if so, is trying to run both queries at the same time... because the if statement at line 36 suggest that the condition is to $_POST be true.

But this is my other question.

I don't see an 'or die()' function in either queries, at least not in the first post. Then how can you get an error echoed? I just see an 'or die()' function in the database connection function only.

The post actually had the value Update, changed it to update and tried to execute both querys and still getting "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"

I have also create a or die(mysql_error()); on the $result and $num I'll attach a fresh version of my code

<?php
include("admin_header.php"); 

$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;

	$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
	mysql_select_db("gallery") or die ("Couldnt find database");

$query = "SELECT * FROM artist WHERE artist_id = ".$id.";";
$result=mysql_query($query) or die(mysql_error()); 
$num=mysql_num_rows($result) or die(mysql_error());
mysql_close();

echo $result;
echo $num;
$i=0;
while ($i<$num){
	
	$firstname=mysql_result($result,$i,"firstname");
	$surname=mysql_result($result,$i,"surname");
	$bibliography=mysql_result($result,$i,"bibliography");
	$phone=mysql_result($result,$i,"phone");
	$email=mysql_result($result,$i,"email");
	
	echo '<form action="admin_artist_edit.php" method="post">
	<td align="center"><input name="edit_id" type="hidden" value="'; echo $id; echo '"></td></br>
	<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'; echo $firstname; echo '"></td></br>
	<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'; echo $surname; echo '"></td></br>
	<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'; echo $bibliography; echo '"></td></br>
	<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'; echo $phone; echo '"></td></br>
	<strong>Email:</strong><td align="center"><input name="email" type="text" value="'; echo $email; echo '"></td></br>
	<input type="submit" name="submit" value="submit">
	</form>';
++$i;
}
if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

if (isset($_POST['submit']) && $_POST['submit'])
{
$query=mysql_query("UPDATE artist SET firstname='$edit_firstname', surname='$edit_surname', bibliography='$edit_bibliography', phone='$edit_phone', email='$edit_email' WHERE artist_id='$edit_id'
");
if($review_update > 0){
echo 'Record Updated';
} else {
echo 'Unable to Update';
}
 
mysql_close();
}


?>

I've changed the code like this... see if it's work!

//Getting the artist where the id match
$query = "SELECT * FROM artist WHERE artist_id = ".$id.";";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_num_rows($result);

//creating an edit form

// Changed code
if($num > 0)
	while ($a = mysql_fetch_object($result)){
		
		$firstname=$a->firstname;
		$surname=$a->surname;
		$bibliography=$a->bibliography;
		$phone=$a->phone;
		$email=$a->email;
		
		echo '<form action="admin_artist_edit.php" method="post">
		<td align="center"><input name="edit_id" type="hidden" value="'; echo $id; echo '"></td></br>
		<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'; echo $firstname; echo '"></td></br>
		<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'; echo $surname; echo '"></td></br>
		<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'; echo $bibliography; echo '"></td></br>
		<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'; echo $phone; echo '"></td></br>
		<strong>Email:</strong><td align="center"><input name="email" type="text" value="'; echo $email; echo '"></td></br>
		<input type="submit" value="Update">
		</form>';
	
	}
}
mysql_close();

Just change the mysql_close(); after the result. I always use mysql_fetch_object() as my preference.

I'm still getting the same error message. I dunno what is causing it. I'm more then appreciating your help that you giving me to tell me where I'm wrong since I'm new to PHP.

I made some changes to the code... see if it works

<?php
include("admin_header.php"); 

$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;

$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
mysql_select_db("gallery") or die ("Couldnt find database");

$query = "SELECT * FROM `artist` WHERE `artist_id` = ".$id.";";
$result=mysql_query($query) or die(mysql_error()); 
$num=mysql_num_rows($result); //changed
mysql_close();

echo $result;
echo $num;

// Changed code
if($num > 0)
	while ($a = mysql_fetch_object($result)){
		
		$firstname=$a->firstname;
		$surname=$a->surname;
		$bibliography=$a->bibliography;
		$phone=$a->phone;
		$email=$a->email;
		
		echo '<form action="admin_artist_edit.php" method="post">
		<td align="center"><input name="edit_id" type="hidden" value="'; echo $id; echo '"></td></br>
		<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'; echo $firstname; echo '"></td></br>
		<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'; echo $surname; echo '"></td></br>
		<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'; echo $bibliography; echo '"></td></br>
		<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'; echo $phone; echo '"></td></br>
		<strong>Email:</strong><td align="center"><input name="email" type="text" value="'; echo $email; echo '"></td></br>
		<input type="submit" value="Update">
		</form>';
	}
}
mysql_close(); //moved after results


if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

if (isset($_POST['submit']) && $_POST['submit'])
{
$query=mysql_query("UPDATE `artist` SET `firstname`='$edit_firstname', `surname`='$edit_surname', `bibliography`='$edit_bibliography', `phone`='$edit_phone', `email`='$edit_email' WHERE `artist_id`='$edit_id';");
$review_update = mysql_affected_rows(); //Added
if($review_update > 0){
echo 'Record Updated';
} else {
echo 'Unable to Update';
}
 
mysql_close();
}


?>

I just changed the mysql_close in the Select query to after the result displayed, remove one or die() after the mysql_num_rows that's not needed. Then change the while statement a little bit.

What an Idiot am I! gosh... Sorry I didn't catch this before.

Are you receiving the error when selecting the artist to edit or when updating the information?

The first query is always running even if $id is not set.

Try this!

<?php
include("admin_header.php"); 

$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;

$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
mysql_select_db("gallery");

if(isset($id)){
$query = "SELECT * FROM `artist` WHERE `artist_id` = ".$id.";";
$result=mysql_query($query) or die(mysql_error()); 
$num=mysql_num_rows($result); //changed
mysql_close();

echo $result;
echo $num;

// Changed code
if($num > 0)
	while ($a = mysql_fetch_object($result)){
		
		$firstname=$a->firstname;
		$surname=$a->surname;
		$bibliography=$a->bibliography;
		$phone=$a->phone;
		$email=$a->email;
		
		echo '<form action="admin_artist_edit.php" method="post">
		<td align="center"><input name="edit_id" type="hidden" value="'.$id.'"></td></br>
		<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'.$firstname.'"></td></br>
		<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'.$surname.'"></td></br>
		<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'.$bibliography.'"></td></br>
		<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'.$phone.'"></td></br>
		<strong>Email:</strong><td align="center"><input name="email" type="text" value="'.$email.'"></td></br>
		<input type="submit" value="Update">
		</form>';
	}
}
} else {
	echo '<h1>Provide Id</h1>';
}


if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

if (isset($_POST['submit']) && $_POST['submit'])
{
$query=mysql_query("UPDATE `artist` SET `firstname`='".$edit_firstname."', `surname`='".$edit_surname."', `bibliography`='".$edit_bibliography."', `phone`='".$edit_phone."', `email`='".$edit_email."' WHERE `artist_id`='".$edit_id."';");
$review_update = mysql_affected_rows(); //Added
if($review_update > 0){
echo 'Record Updated';
} else {
echo 'Unable to Update';
}
 
}

mysql_close();
?>

The selecting should not be process if $id is null. So is running even when you're updating the information, but because we close the mysql connection the second query will not be processed because you need to open the connection again, so I delete the first mysql_close(); and enclosed the first query in an if statement. See if this work.

Still getting the same error. Also I deleted one of the } on line 36 since it gave me an syntax error. Also it gives me an error stating

'Warning: mysql_close(): no MySQL-Link resource supplied in C:\wamp\www\Practical_Project\admin_artist_edit.php on line 37'

Yes I see, my mistake... sorry I need my coffee :)
Try this:

<?php
include("admin_header.php"); 

$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;

$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
mysql_select_db("gallery");

if(isset($id)){
$query = "SELECT * FROM `artist` WHERE `artist_id` = ".$id.";";
$result=mysql_query($query) or die(mysql_error()); 
$num=mysql_num_rows($result); //changed

echo $result;
echo $num;

// Changed code
if($num > 0){
	while ($a = mysql_fetch_object($result)){
		
		$firstname=$a->firstname;
		$surname=$a->surname;
		$bibliography=$a->bibliography;
		$phone=$a->phone;
		$email=$a->email;
		
		echo '<form action="admin_artist_edit.php" method="post">
		<td align="center"><input name="edit_id" type="hidden" value="'.$id.'"></td></br>
		<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'.$firstname.'"></td></br>
		<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'.$surname.'"></td></br>
		<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'.$bibliography.'"></td></br>
		<strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'.$phone.'"></td></br>
		<strong>Email:</strong><td align="center"><input name="email" type="text" value="'.$email.'"></td></br>
		<input type="submit" value="Update">
		</form>';
	}
} else {
	echo '<h1>Provide Id</h1>';
}


if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

if (isset($_POST['submit']) && $_POST['submit'])
{
$query=mysql_query("UPDATE `artist` SET `firstname`='".$edit_firstname."', `surname`='".$edit_surname."', `bibliography`='".$edit_bibliography."', `phone`='".$edit_phone."', `email`='".$edit_email."' WHERE `artist_id`='".$edit_id."';");
$review_update = mysql_affected_rows(); //Added
if($review_update > 0){
echo 'Record Updated';
} else {
echo 'Unable to Update';
}
 
}


mysql_close();
?>

forgot to remove the first mysql_error(); in line 13 and forgot one open { curly bracket in the if statement... Let me do my coffee. keep me posted!

Sorry mate, stupid net didn't give me an update. Well now if I hit the update button it comes up as "Provide ID"

And with your last update I'm getting ( ! ) Parse error: syntax error, unexpected $end in C:\wamp\www\Practical_Project\admin_artist_edit.php on line 66. Haha don't worry about it, you been helping me allot to get though this.

That's good your not getting the MySQL error... the rest is just little typos in the code let me see what's wrong and I post the code.

OK, here it is, I hope:

<?php
include("admin_header.php"); 

$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;

$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
mysql_select_db("gallery");

if(isset($id)){
    $query = "SELECT * FROM `artist` WHERE `artist_id` = ".$id.";";
    $result=mysql_query($query) or die(mysql_error()); 
    $num=mysql_num_rows($result); //changed

    echo $result;
    echo $num;

    // Changed code
    if($num > 0){
        while ($a = mysql_fetch_object($result)){

            $firstname=$a->firstname;
            $surname=$a->surname;
            $bibliography=$a->bibliography;
            $phone=$a->phone;
            $email=$a->email;

            echo '<form action="admin_artist_edit.php" method="post">
            <td align="center"><input name="edit_id" type="hidden" value="'.$id.'"></td></br>
            <strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'.$firstname.'"></td></br>
            <strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'.$surname.'"></td></br>
            <strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'.$bibliography.'"></td></br>
            <strong>Phone:</strong><td align="center"><input name="phone" type="text" value="'.$phone.'"></td></br>
            <strong>Email:</strong><td align="center"><input name="email" type="text" value="'.$email.'"></td></br>
            <input type="submit" value="Update">
            </form>';
        }
    }
} // this little guy cause the error


if( isset($_POST['submit']) && $_POST['submit']){
    // Because the field names are the same as the variable names you can to this instead
    foreach($_POST as $k=>$v){
            ${$k} = $v;	//Dynamic Variables;
    }

    $query=mysql_query("UPDATE `artist` SET `firstname`='".$edit_firstname."', `surname`='".$edit_surname."', `bibliography`='".$edit_bibliography."', `phone`='".$edit_phone."', `email`='".$edit_email."' WHERE `artist_id`='".$edit_id."';");
    $review_update = mysql_affected_rows(); //Added
    if($review_update > 0){
    echo 'Record Updated';
    } else {
    echo 'Unable to Update';
    } 
}


mysql_close();
?>

The error was a curly bracket in the if statement I create, also I remove the else that echo Provide ID, because we're using the same PHP code to process the edit form and the update form. Also I simplify the code a little bit as follow:

The original code was:

if( isset($_POST['submit']) && $_POST['submit'])
{ 
$edit_id = ($_POST['edit_id']);
$edit_firstname=$_POST['edit_firstname'];
$edit_surname=$_POST['edit_surname'];
$edit_bibliography=$_POST['edit_bibliography'];
$edit_phone=$_POST['edit_phone'];
$edit_email=$_POST['edit_email'];
}

Because the fields and variables has the same name and post is an array you can do this, less coding:

foreach($_POST as $k=>$v){
    ${$k} = $v;	//Dynamic Variables;
}

And also because is the same condition I merge both if(isset($_POST)) statements:

if( isset($_POST['submit']) && $_POST['submit']){
    // Because the field names are the same as the variable names you can to this instead
    foreach($_POST as $k=>$v){
            ${$k} = $v;	//Dynamic Variables;
    }

    $query=mysql_query("UPDATE `artist` SET `firstname`='".$edit_firstname."', `surname`='".$edit_surname."', `bibliography`='".$edit_bibliography."', `phone`='".$edit_phone."', `email`='".$edit_email."' WHERE `artist_id`='".$edit_id."';");
    $review_update = mysql_affected_rows(); //Added
    if($review_update > 0){
    echo 'Record Updated';
    } else {
    echo 'Unable to Update';
    } 
}

At last I moved the mysql_close(); outside the if statements and the last thing the code will execute to make sure both queries use the same connection.

Hope this work, if not I need a beer, :) I don't drink.

Haha better get that beer, sorry to do this to you :)
Now when I hit the update button I get sent to a blank screen and it not update in the database.

I've finally got it to working

We just forgot to submit button name and phone and email name were incorrect, so I changed it to edit_phone and edit_email here the code below which was causing the trouble.

<strong>Phone:</strong><td align="center"><input name="edit_phone" type="text" value="'.$phone.'"></td></br>
<strong>Email:</strong><td align="center"><input name="edit_email" type="text" value="'.$email.'"></td></br>
<input type="submit" name="submit" value="Update">

Thank you so much for your help raphie you are a lifesaver :)

Here is the working code

<?php
include("admin_header.php");
 
$id = isset($_GET['artist_id']) ? $_GET['artist_id'] : null;
 
$connect = mysql_connect ("localhost","root","") or die("Unable to connect to mysql database server");
mysql_select_db("gallery");
 
if(isset($id)){
$query = "SELECT * FROM `artist` WHERE `artist_id` = ".$id.";";
$result=mysql_query($query) or die(mysql_error());
$num=mysql_num_rows($result); //changed
 
echo $result;
echo $num;
 
// Changed code
if($num > 0){
while ($a = mysql_fetch_object($result)){
 
$firstname=$a->firstname;
$surname=$a->surname;
$bibliography=$a->bibliography;
$phone=$a->phone;
$email=$a->email;
 
echo '<form action="admin_artist_edit.php" method="post">
<td align="center"><input name="edit_id" type="hidden" value="'.$id.'"></td></br>
<strong>First Name:</strong><td align="center"><input name="edit_firstname" type="text" value="'.$firstname.'"></td></br>
<strong>Surname:</strong><td align="center"><input name="edit_surname" type="text" value="'.$surname.'"></td></br>
<strong>Bibliography:</strong><td align="center"><input name="edit_bibliography" type="text" value="'.$bibliography.'"></td></br>
<strong>Phone:</strong><td align="center"><input name="edit_phone" type="text" value="'.$phone.'"></td></br>
<strong>Email:</strong><td align="center"><input name="edit_email" type="text" value="'.$email.'"></td></br>
<input type="submit" name="submit" value="Update">
</form>';
}
}
} // this little guy cause the error
 
 
    if( isset($_POST['submit']) && $_POST['submit']){
    // Because the field names are the same as the variable names you can to this instead
    foreach($_POST as $k=>$v){
    ${$k} = $v; //Dynamic Variables;
    }
     
    $query=mysql_query("UPDATE `artist` SET `firstname`='".$edit_firstname."', `surname`='".$edit_surname."', `bibliography`='".$edit_bibliography."', `phone`='".$edit_phone."', `email`='".$edit_email."' WHERE `artist_id`='".$edit_id."';");
    $review_update = mysql_affected_rows(); //Added
    if($review_update > 0){
    echo 'Record Updated';
    } else {
    echo 'Unable to Update';
    }
    }
 
 
mysql_close();
?>

Ay Chihuahua!!! Let me see what's wrong!

Ok, the only thing I can see is this... in line 42 the if statement has

if( isset($_POST['submit']) && $_POST['submit']){

Change it to:

if( isset($_POST['submit']) && $_POST['submit'] == 'Update'){

Glad to help.... Good luck with PHP, is the best web language and powerful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.