![]() |
Are you sure you want to delete? Not working
I have a link that will delete an entry in my database table, but I would like a pop up that will ask if you "Are you sure". My code does not work, and I was wondering if someone could help me.
My existing code that works: Code:
echo '<td><a href="delete_job.php?id=' . $row['ID'] . ' ">Delete</a></td>';Code:
echo '<td><a href="delete_job.php?id=' . $row['ID'] . ' " onclick="return confirm('Are you sure you want to delete?')">Delete</a></td>'; |
It will not work using href. Since you are using javascript already,
Look for 'location javascript' on google |
Thanks for getting back. I will have to look into that. Thanks again.
|
Quote:
Bring up the page in your browser. Click on the browser's VIEW menu. Click on the SOURCE or PAGE SOURCE menu item. Find that line in the HTML and copy/paste the HTML here. |
you can generate the pop up using javascript functionality..
|
HI ! Old Pedant you are write. it works.
|
Hello all.
I hate to sound ignorant, but I get an error with that line of code. This is the error that I get: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /homepages/41/d383225633/htdocs/test38/admin/view_jobs.php on line 58 |
Quote:
Anyway I don't know how java script can affect/connect to href value. Does not look logical to me. |
Thanks BubikolRamios.
Yeah, I don't even get it to work in Chrome. When I upload the file and view the page, it just displays that syntax error. |
Try this, id does not actualy delete anything, it demonstrates linking upon confirmation.
The bottom link should work on all browsers, while upper does not work on IE 8. Code:
<!DOCTYPE html>It has nothing to do with ..... When your PHP will be error free, then you wil still have to look at html page source (and that should look something like my upper code.) I doubt you can look at PHP generated html source as old pedant suggested, at this stage, coz I asume it is nothin there, due to error. EDIT: Not PHP man myself, but if you look here: http://php.net/manual/en/language.operators.string.php all strings are inside "" not inside '' like in your case ..... There might be your problem. |
Thanks BubikolRamios.
Your code did work when it was the only thing on my page, BUT.... did not work when I tried to incorporate it within my code(hyperlink).I just got a syntax error. If you (or anyone) wouldn't mind, you can the actual domain at http://clearcreekhoney.com That way you could actually edit it. I know it is a hassle for you, but I am getting frustrated, and am trying to cross (understand) this hurdle. The ftp info is: Username: u65618807-CLRcreek Password: !clear23 My delete does work, BUT not with the "warning" popup. Thank you. Sincerely, Eggweezer |
Quote:
PHP code happens *BEFORE* the browser ever *SEES* the code, at all. If you don't show the PHP code where that error is nobody can help you. HINT: Any error message that includes T_xxxx is a PHP error. Unless you actually had a variable or function name that started with T_ there is no standard JavaScript error that would look like that. |
Here is my code that DOES NOT give an error, and correctly goes to the hyperlink.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
just a note, are you sure you need space there (marked with underline):
$row['ID'] . '_" onclick |
I just removed the space to no avail.
If it helps, you can see it at www.clearcreekhoney.com If it is easier for you, you can download the index.php file and play with it (of course, unless it is a hassle) The ftp login is: Username: u65618807-CLRcreek Password: !clear23 Thank you. |
| All times are GMT +1. The time now is 01:10 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.