Jump to content

Archived

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

Mantis_61

http and post array

Recommended Posts

I've noticed when I send form requests to a file that stores the form input into variables I cannot use include this file with other files. Why is that? Can I not store the input into variables?

[code]
<?php
echo <<<end
<form action=".../process.php" method="post">
<select name="type">
<option value="a">A</option>
<option value=a+">A pos</option>
</select>
</form>
end;
?>[/code]
process...

[code]
<?php
$type = "{$_POST['type']}";
echo $type;
?>[/code]
however when I use an isset() it returns true?
Is this due to the state or security?

Share this post


Link to post
Share on other sites
I'm sorry I didn't quite complete that. That does print there but when I include process.php in with
other php files and attempt to echo the variable it does not display the input.

Share this post


Link to post
Share on other sites
First off, you dont need the "" or the {} around the $var assignment

$type = $_POST['type'];

And it will return true always because you will always have one value selected since you did not provide a null option in the form (even so you'd have to use empty() to test for a null value)

Share this post


Link to post
Share on other sites
I have the extra q marks and brackets prepending for a sql statement but it still isn't storing my values from the form? and I know I got typos up there it isn't the original script but the original gives no errors. I was just wanting to know if I do store these values from the post array into variables and include that file will it work? I'm trying to send data from a form to 2 different form processors. Is there another method to do this? 

Share this post


Link to post
Share on other sites
well I found other methods just requires more typing. I'd still like to know why my post elements aren't storing.

Share this post


Link to post
Share on other sites

×

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.