0

Hey! I want it so that the user presses an A tag, a link, to submit a form. Here is some of my code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>jeje</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript">
	function popup(url, height, width,form){
	    newwindow = window.open(url,'333','height='+height+',width='+width);
	    if (window.focus) newwindow.focus();
	    if(form) form.target = '333';
	}
    </script>
  </head>
  <body>
      <form action="#" method="post" id="myform">
	  <input type="input" name="abc">
	  <a href="#" onclick="forms['myform'].submit();popup('http://3rlend.com/post.php',400,300,forms['myform']);">Submit</a>
      </form>
  </body>
</html>

But this does not work. I have been trying so many things, this is not my first try.
Please tell me what's wrong, or give me a good code!

Thanks

EDIT: the error is that $_POST in the php file is empty

Edited by ErlendHL: notice

2
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by fxm
0

All you need is something like this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title>
      jeje
    </title>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=us-ascii">
    <script type="text/javascript">
        function popup(uri,height, width){
            newwindow = window.open(uri,'333','height='+height+',width='+width);
            newwindow.focus();
        }
    </script>
  </head>
  <body>
    <form action="#" method="post" id="myform">
      <input type="text" name="abc">
	<a href="#" onclick="forms['myform'].submit();popup('http://3rlend.com/post.php',400,300);return false">
      Submit</a>
    </form>
  </body>
</html>

(because the target business was all meaningless).

However, the return page still has no value and it is very badly formed (nothing but a <head>). What is your php code?

Edited by fxm: n/a

0

Some progress.
This

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title>
      jeje
    </title>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=us-ascii">
    <script type="text/javascript">
    function popit(name,height, width){
            newwindow = window.open('',name,'height='+height+',width='+width);
            newwindow.focus();
        }
    </script>
  </head>
  <body>
    <form target="333" action="http://3rlend.com/post.php" method=
    "post" onsubmit="popit(this.target,300,200);return false" id=
    "myform" name="myform">
      <input type="text" name="abc"> <a href="#" onclick=
      "forms['myform'].submit()">Submit</a>
    </form>
  </body>
</html>

returns the characters that were typed in a new window - but at the moment it isn't popping up.

0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title>
      jeje
    </title>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=us-ascii">
    <script type="text/javascript">
	function popit(name,height, width){
          newwindow = window.open("",name,"height="+height+",width="+width);
          newwindow.focus();
        }
    </script>
  </head>
  <body>
    <form target="333" action="http://3rlend.com/post.php" method="post" id="myform">
      <input type="text" name="abc">
      <a href="#" onclick="popit(forms['myform'].target,300,200);forms['myform'].submit();return false">Submit</a>
    </form>
  </body>
</html>

Edited by fxm: n/a

0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <title>
      jeje
    </title>
    <meta http-equiv="Content-Type" content=
    "text/html; charset=us-ascii">
    <script type="text/javascript">
	function popit(name,height, width){
          newwindow = window.open("",name,"height="+height+",width="+width);
          newwindow.focus();
        }
    </script>
  </head>
  <body>
    <form target="333" action="http://3rlend.com/post.php" method="post" id="myform">
      <input type="text" name="abc">
      <a href="#" onclick="popit(forms['myform'].target,300,200);forms['myform'].submit();return false">Submit</a>
    </form>
  </body>
</html>

Thanks a lot, fxm! Now it works fine :D

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.