MikeDXUNL Posted June 5, 2007 Share Posted June 5, 2007 Alright, I have a form: <form action="#" name="lytcode" method="post"> <textarea name="lytcode" cols="65" rows="10" onClick="this.focus();this.select()"> TEXTGOESHERE </textarea> <input type="submit" value="Submit" class="sub_login" onClick="window.open('../../preselflay.php','lytcode','width=700,height=600')"> </form> when i click Submit, it is supposed to post the stuff in the TextArea onto the page. but instead it just shows up blank on the preselflay.php page, i am using: $_POST['lytcode']; any help is much appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/ Share on other sites More sharing options...
per1os Posted June 5, 2007 Share Posted June 5, 2007 You can't really pass stuff to a page via post in a new window like you have. This is really a javascript question, not PHP. The question would be how do you pass post data from the form into a new window. Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268703 Share on other sites More sharing options...
papaface Posted June 5, 2007 Share Posted June 5, 2007 To open in a new window all you have to do is put target="_blank" in the form part: <form action="#" name="lytcode" method="post" target="_blank"> Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268707 Share on other sites More sharing options...
chigley Posted June 5, 2007 Share Posted June 5, 2007 You could do this: <form action="otherpage.php" name="lytcode" method="post"> <textarea name="lytcode" cols="65" rows="10" onClick="this.focus();this.select()"> TEXTGOESHERE </textarea> <input type="submit" value="Submit" class="sub_login" onClick="window.open('../../preselflay.php','lytcode','width=700,height=600')"> </form> Then in otherpage.php: <?php $url = "../../preselflay.php?"; foreach($_POST as $key => $value) { $url .= "{$key}={$value}& } echo "<script type=\"text/javascript\"> window.open('{$url}','lytcode','width=700,height=600'); </script>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268708 Share on other sites More sharing options...
per1os Posted June 5, 2007 Share Posted June 5, 2007 You could do this: <form action="otherpage.php" name="lytcode" method="post"> <textarea name="lytcode" cols="65" rows="10" onClick="this.focus();this.select()"> TEXTGOESHERE </textarea> <input type="submit" value="Submit" class="sub_login" onClick="window.open('../../preselflay.php','lytcode','width=700,height=600')"> </form> Then in otherpage.php: <?php $url = "../../preselflay.php?"; foreach($_POST as $key => $value) { $url .= "{$key}={$value}& } echo "<script type=\"text/javascript\"> window.open('{$url}','lytcode','width=700,height=600'); </script>"; ?> If he is going to go through that work might as well just use sessions, right? <?php session_start(); $url = "../../preselflay.php"; foreach($_POST as $key => $value) { $_SESSION[$key] = $value; } echo "<script type=\"text/javascript\"> window.open('{$url}','lytcode','width=700,height=600'); </script>"; ?> Just make sure you call session_start() at the very top of the preselflay.php and use $_SESSION instead of $_POST to access the data. Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268712 Share on other sites More sharing options...
MikeDXUNL Posted June 5, 2007 Author Share Posted June 5, 2007 thanks for the two that tried to keep it to popup by JS in a new window, but I just went with the target="_blank" even though i cant specify a window X and Y. Thanks all. Quote Link to comment https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268721 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.