PHP and forms - submission problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DARKGuy
Forum Newbie
Posts: 3
Joined: Mon Apr 18, 2005 10:17 am

PHP and forms - submission problems

Post 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
siefkencp
Forum Commoner
Posts: 69
Joined: Thu Dec 16, 2004 8:50 am

Post 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
DARKGuy
Forum Newbie
Posts: 3
Joined: Mon Apr 18, 2005 10:17 am

Post 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?
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post 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?
DARKGuy
Forum Newbie
Posts: 3
Joined: Mon Apr 18, 2005 10:17 am

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

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