By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

how to submit multiple form on single submit button with different actions

P: 3
I am trying to login for website with autologin to forum,and vcalender
its work fine in mozilla and ie but it gives problem in safari(IN MAC)

following is the code

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. if(isset($_POST['btnsubmit']))
  4. {
  5. //echo "<pre/>";
  6. //print_r($_POST);
  7.  
  8. $username=$_POST['txtuser'];
  9. $password=$_POST['txtpass'];
  10.  
  11. $flag=0;
  12. $str =" ";
  13. $sql = "Select * from user_mast where user_name='".$username."' and pass='".$password."'";
  14. //echo $sql;
  15. $result = mysql_query($sql);
  16. $rec = mysql_num_rows($result);
  17. $row = mysql_fetch_array($result);
  18.  
  19. if($rec>0)
  20. {
  21.  $flag =1;
  22.  $str= " ";
  23.  //$user_role = $row[role_id];
  24.  $sql = "update user_mast set login_status =1 where user_name='".$username."' and pass='".$password."'";
  25. //echo $sql;
  26. mysql_query($sql);
  27.  
  28.  $_SESSION[admin_user_id] = $row[user_id];
  29.  $_SESSION[admin_user_name]= $row[user_name];
  30.  
  31.   $_SESSION['id'] =  $username;
  32.  
  33.                     echo '<form id="Login" name="Login" method="post" action="../admin/vcalendar/login.php?ccsForm=Login" >
  34.                         <input type="hidden" name="login" value="'. $username.'" maxlength="100" size="20">
  35.                         <input type="hidden" name="password" value="'. $password.'" maxlength="100" size="20">
  36.                         <input name="hidden" type="button" value="Login">
  37.                         </form>';
  38.  
  39.                         //$password = "admin123";
  40.  
  41.                     echo '<form id="frmforumlogin" name="frmforumlogin" action="../Forum/login.php?login=true&admin=true" method="post" enctype="multipart/form-data" >
  42.                     <input type="hidden" name="username" value="'. $username.'"><br />
  43.                      <input type="hidden" name="password" value="'. $password.'"><br />
  44.                     <input type="hidden" name="redirect" value="../">
  45.                     <input type="hidden" name="login" value="123">
  46.                     <input type="hidden" value="" name="login">
  47.                     </form>';
  48.  
  49.           // echo '<form name="frmadmin_check" action="home.php" method="post">
  50. //                  </form>';
  51.             echo '<script language="javascript">
  52.                      document.Login.submit();
  53.                      document.frmforumlogin.submit()
  54.                      document.location.href="home.php";
  55.                     </script>';
  56.  
  57.  
  58.  
  59. }
  60. else
  61.  $str =   "<font color='#FF0000'>Invalid User Name or Password.!</font>";
  62. }
  63.  

Thanks
Apr 14 '10 #1
Share this Question
Share on Google+
4 Replies


P: 3
@velocity00723
Does anyone face this problem befor?
Apr 15 '10 #2

code green
Expert 100+
P: 1,726
Does anyone face this problem befor
It may help if you state what the problem is
but it gives problem in safari
In the mean time I suggesting testing the HTML source code at W3C
Apr 15 '10 #3

P: 3
@code green
ok i try to explain,
when user enter his user name and password ,user must be login to mysite as well as to the phpbb forum and vcalender (which are third party tools), i just passed the user information to the respective login pages of phpbb and vcalender but it gives some problem,
it get login in my site but not in forum and vcalender
Apr 19 '10 #4

P: 1
You have 3 forms with different actions, what do you expect to see? 3 browser windows or what?
if you want to solve this problem this way i can suggest you to create 3 iframes , with different names, and target all that forms to that iframes, then you will be able to login user to all that sites on a single page.

PS. use jquery for javascript, it very easy and cross browser
Apr 19 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.