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:
It will not work using href. Since you are using javascript already,
Look for 'location javascript' on google
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
Users who have thanked BubikolRamios for this post:
echo '<td><a href="delete_job.php?id=' . $row['ID'] . ' " onclick="return confirm('Are you sure you want to delete?')">Delete</a></td>';
I think Bubikol is totally wrong. That should work just fine.
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Hmm, realy, I tested it on FF and GC and there it works, on IE8 does not work as expected, whatewer you click it goes to href.
Anyway I don't know how java script can affect/connect to href value.
Does not look logical to me.
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
Users who have thanked BubikolRamios for this post:
all strings are inside "" not inside '' like in your case ..... There might be your problem.
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
Last edited by BubikolRamios; 02-10-2013 at 01:34 AM..
Users who have thanked BubikolRamios for this post:
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
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
That is a PHP error. It has nothing whatsoever to do with whatever browser you are using.
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
just a note, are you sure you need space there (marked with underline):
$row['ID'] . '_" onclick
__________________
Found a flower or bug and don't know what it is ? agrozoo.net galery
if you don't spot search button at once, there is search form: agrozoo.net galery search
Users who have thanked BubikolRamios for this post: