Button "onClick" problem

Associate
Joined
1 May 2006
Posts
810
Location
Bristol, UK
Afternoon all,

I've got a little problem with a button :p
I'm trying to use the goTo function to link to another page but no matter how many different times I've tried, it simply won't work.
Here's how it looks at present:
Code:
<input name="button22" value="Yes" type=button onClick="goTo(deletefavlink.php?uid=<?php echo $row_favlinks['uid']; ?>)">
Any ideas guys?

Cheers
 
Do you have the goTo() function defined somewhere, like in the <head> or an external script? What is the definition of the goTo() function?
 
Ah, I haven't defined the goTo function anywhere this is undoubtably my problem.

I'm trying to get the button to link to:
Code:
deletefavlink.php?uid=<?php echo $row_favlinks['uid']; ?>
I undersand that this could be easily done using a standard href link but I want use a button as its part of a form.

Cheers
 
Add the javascript function in the <head>, and it should work fine as it is. Something like:
Code:
<script type="text/javascript">
function goTo(url) {
  document.location.href = url;
}
</script>
should do the trick.
 
Solved.

I put form tags around the button and set action to deletefavlink.php?uid=<?php echo $row_favlinks['uid']; ?>

I tried your method Augmented but it didnt work :( cheers anyway :)
 
Back
Top Bottom