confirm delete

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

confirm delete

Post by eektech909 »

I'm using a javascript to confirm a deletion when an image is pressed. I want the page to be redirected when you click OK at the confirm box. But the url has to include some variables from the php page like $name blah blah...
how can I include that into the javascript code when the javascript function is outside the php code?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

echo it into the Javascript code just like you would HTML.
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

Post by eektech909 »

Code: Select all

function codel() {
	var message = "Are you sure you want to delete this show?";
	var return_value = confirm(message);
	if (return_value == true) {
  window.location= "<?php echo ('del.php?thedate=' . ($row["DATE"]) . '&thevenue=' . htmlentities($row["VENUE"]) . ''); 
  ?>";
 		exit;
	} else {
		}
}
it redirected me to

del.php?thedate=&thevenue=

it didn't fill in the variables
eektech909
Forum Commoner
Posts: 34
Joined: Fri Jun 09, 2006 3:59 pm

Post by eektech909 »

got it!
Post Reply