Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/54335-why-form-wont-post/
Share on other sites

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>";

?>

Link to comment
https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268708
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/54335-why-form-wont-post/#findComment-268712
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.