Jump to content

Why form won't post??!


MikeDXUNL

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.