Forum Moderators: coopster

Message Too Old, No Replies

$var = $_GET["var"] with POST?

         

sebbothebutcher

8:51 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



i have a question: i'm new to php so i created a very small programme that writes something into a file.
the main file has a textarea and a submit button.

<form action="textwrite.php" method="get" name="textform" id="textform">
<p>
<textarea name="text" cols="40" rows="10" id="text"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Save">
<input type="reset" name="Reset" value="Delete">
</p>
</form>

currently the form method is GET because the file "textwrite.php" uses
$text = $_GET["text"];

can i also use POST in the form? if not, what else can i use to assign the textarea input to a variable?
thanks in advance!

jatar_k

9:09 pm on Apr 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you can change the method of the form to post and then swap tha vars in the file from $_GET['varname'] to $_POST['varname']

sebbothebutcher

9:30 pm on Apr 19, 2004 (gmt 0)

10+ Year Member



okay thank you! it worked!