View Full Version : Multiple Function Href

05-07-2007, 02:40 PM
I would like to do multiple functions on one onclick, then go to a new page.
Here is my attempt using one function to do two things. Suggestions please

<SCRIPT language="JavaScript">
function submitform()
default_b.php?action=add_item&id=<?php echo $row["id"]; ?>&qty=1">

<form name="form" action="">
<input type='checkbox' name='chk'>

<A href="#" onClick=" submitform();return false;">Add Item</A>

05-08-2007, 09:33 AM
I'm not really sure what the question is. I'll tell you what your code does though. When you click the anchor, it will go to your function and submit the form, which will POST to the current page. Never executing this mysterious line

default_b.php?action=add_item&id=<?php echo $row["id"]; ?>&qty=1">

I assume this is some kind of link you want to forward the browser to. As it is written, you'll need to use AJAX to save the form, instead (plenty of online tutorials available for AJAX) and window.location = "your uri"; after the AJAX call.

However, it would be much simpler, if you use PHP code wherever you process the form submission, to forward to the next page instead.