Page 1 of 1

PHP and forms - submission problems

Posted: Mon Apr 18, 2005 10:28 am
by DARKGuy
Yes... well, I'm trying to use a comments submission thingy, but the format must be like:

http://www.whatever.com/?username=TheUs ... ommentHere

Thing is, in my main PHP file, I have the user name as a variable $user, but when I use this code in the submit thingy, apart that it doesn't reads the parameters, doesn't even sends them.

Bits from my main.php

Code: Select all

<FORM method="post" ACTION="scripts/commentsubmit.php?user=$user">
<center><TEXTAREA NAME="comments" ROWS=5 COLS=30></TEXTAREA>
<INPUT TYPE="submit" VALUE="Submit"></center>
</FORM>
From the commentsubmit.php

Code: Select all

$me = $_POST['user']; 
$text = $_POST['comments']; 

echo $text . "<br>";
echo $me . "<br>";
If there's more needed info I'll post though. What I really need to know is how to pass that variable as another parameter inside the form tag, as, you could have seen my try up there, it gets the comments but not the name, as isn't being sent :(

If anyone could help me it would be awesome ^_^

Thanks in advance :)
-DARKGuy

Posted: Mon Apr 18, 2005 10:55 am
by siefkencp
I ussually acomplish variable tracking with 1 of 3 ways.

1 I use a hidden form input.
2 I use sessions.
3 I use cookies.

I am not sure that what you are trying to do will work.

Chris

Posted: Mon Apr 18, 2005 2:03 pm
by DARKGuy
I could try to use a hidden form input with a predefined text then send both, but then, how would I hide it?

Posted: Mon Apr 18, 2005 2:17 pm
by phpScott

Code: Select all

<form name=&quote;someFormName&quote; type=&quote;post&quote; action=&quote;somePage.php&quote; id=&quote;someIdValue&quote;>
<input type=&quote;hidden&quote; name=&quote;whateveryouwant&quote; id=&quote;justToBeXHTML&quote; value=&quote;what ever value you want to hide&quote; />
//the rest of your form stuff here or above the hidden intput type
</form>
hope that helps?

Posted: Mon Apr 18, 2005 2:48 pm
by DARKGuy
It did!!! thanks a lot!! :D

A little thing though, using the chance :P How do I make my textarea form to wrap the text dynamically as the user types?

Posted: Mon Apr 18, 2005 7:49 pm
by feyd

Code: Select all

Wrap Text        &lt;TEXTAREA WRAP=OFF|HARD|SOFT&gt;&lt;/TEXTAREA&gt;