0

I am looking for a unique solution for my issue. I am looking to submit 2 events with 1 onclick. The majority of answers involve creating a function() but part of my function involves using a PHP loop.

Currently this code only executes the second event. Conversely if I switch the events the other event will occur. Basically whichever event is last will execute.

if($result){
    if(mysql_affected_rows() != 0){
      while($row = mysql_fetch_array($result)){ 
              
    echo "<table>";
        echo "<tr style='cursor: pointer' onclick=\"document.location = 'test.php?airport_id=" . $row['id'] . "'; document['myform'].submit(); return false; \";>";
    echo "<td width=100 align=left><font color=#FFFFFF>" . $row['ident'] . "</font></td>";
           

What do you suggest as a solution?

2
  • 1
    You can't submit a form and change the location .. when your form gets submitted, why don't you just redirect on the PHP side? Feb 20, 2013 at 0:10
  • The change location is for my live search function. fpmnky.com/test.php
    – DJ Howarth
    Feb 20, 2013 at 0:14

1 Answer 1

0

Have you ever think to use AJAX? You could submit your form through AJAX. After submission is Okay, trigger your redirect function; This link might help you: http://www.jstiles.com/Blog/How-To-Submit-a-Form-with-jQuery-and-AJAX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.