Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    anything wrong with this script

    Code:
    function gosubmit(address) {
    var address;
    document.myformname.action=address;
    document.myformname.submit();
    return true;
    }
    </script>
    because i want to create something that can submit to different url address in same form using text links, am i correct this way?
    flying dagger

  • #2
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't think your supposed to have "var address" and address as an arguement, so get rid of the "var address" line. Otherwise fine, I think.
    Oh, was I supposed to put something here? ........

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    it is not working, strange, i dont know why please help
    flying dagger

  • #4
    Regular Coder
    Join Date
    Jan 2004
    Location
    Port Huron, MI, U.S.A.
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Let ~me see the code that executes the function and the code for the form itself.
    Oh, was I supposed to put something here? ........

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Code:
    <script language="javascript">
    function gosubmit(address) {
    document.approvearticle.action=address;
    document.approvearticle.submit();
    return true;
    }
    </script>
    <form name=approvearticle>
    $sql=mysql_query("SELECT * FROM pa_article WHERE status=0");
    while ($row=mysql_fetch_array($sql)) {
    	echo "<tr bgcolor=#f5f5f5 align=center><td><input type=\"hidden\" name=\"rowid\" value=\"".$row[id]."\"><input type=\"text\" name=\"title\" value=\"".$row['title']."\"></td><td><input type=text size=5 name=bookid value=".$row['bookid']."></td><td><input type=text name=chapterid size=5 value=".$row['chapterid']."></td>";
    	echo "<td><a href=\"javascript:gosubmit(approvearticle.php?action=update);\">update</a<a href=\"javascript:gosubmit(approvearticle.php?action=preview);\">preview</a>&nbsp;<a href=\"javascript:gosubmit(approvearticle.php?action=approve);\">approve</a></td></tr>";
    }
    ?>
    thanks
    flying dagger

  • #6
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    This should work:
    Code:
    <script type="text/javascript">
    function gosubmit(address) {
      document.approvearticle.action=address;
      document.approvearticle.submit();
      return true;
    }
    </script>
    <form name="approvearticle">
    <table>
    $sql = mysql_query('SELECT `id`, `title`, `bookid`, `chapterid` FROM `pa_article` WHERE `status` = 0');
    while ($row = mysql_fetch_assoc($sql)) {
    	echo '<tr style="background-color:#f5f5f5" align="center"><td><input type="hidden" name="rowid" value="'.$row['id'].'"><input type="text" name="title" value="'.$row['title'].'"></td><td><input type="text" size="5" name="bookid" value="'.$row['bookid'].'"></td><td><input type="text" name="chapterid" size="5" value="'.$row['chapterid'].'"></td>';
    	echo '<td><a href="javascript:gosubmit(\'approvearticle.php?action=update\');">update</a><a href="javascript:gosubmit(\'approvearticle.php?action=preview\');">preview</a>&nbsp;<a href="javascript:gosubmit(\'approvearticle.php?action=approve\');">approve</a></td></tr>';
    }
    ?>
    </table>
    </form>
    dumpfi
    Last edited by dumpfi; 12-25-2004 at 11:02 AM.

  • #7
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    thanks, problem solved
    flying dagger


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •