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

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?

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.

<!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>
<!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

You're quite welcome.
Now, please hit the 'solved' button :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.