submit into a variable

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
nemode
Forum Newbie
Posts: 12
Joined: Sat Nov 01, 2003 11:20 am

submit into a variable

Post by nemode »

how do you put a submitted word into a variable???

$filename = 'txt/ $file .txt' ; ??
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Re: submit into a variable

Post by Fredix »

nemode wrote:how do you put a submitted word into a variable???
Assuming you have a form with an input field and you submit this form to a script using the post method:

$_POST['name_of_the_inputfield'] will contain the string that someone entered in this field.

To learn more about input fields and forms goto http://www.w3schools.com/html

and to learn more about the use of $_POST and $_GET consult http://www.php.net

hope I helped you out
RTT
Forum Commoner
Posts: 38
Joined: Thu Jul 17, 2003 10:22 am
Location: Wolverhampton, UK
Contact:

Post by RTT »

$filename = 'txt/'.$file;

(where $file might be $_POST['file'] or $_GET['file'])
nemode
Forum Newbie
Posts: 12
Joined: Sat Nov 01, 2003 11:20 am

Post by nemode »

sorry i didnt explain myself well. basicly i want to submit a word from a form into into a variable called $filename. the bold is were i want the submited word to be placed.

$filename= "txt/$word.txt"

does that make more sence??
nemode
Forum Newbie
Posts: 12
Joined: Sat Nov 01, 2003 11:20 am

Post by nemode »

yeh cheers RTT![/quote]
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

$filename = "txt/".$_POST['input_field_name'].".txt";

so difficult?
RTT
Forum Commoner
Posts: 38
Joined: Thu Jul 17, 2003 10:22 am
Location: Wolverhampton, UK
Contact:

Post by RTT »

nemode wrote:yeh cheers RTT!
no probs :)
Post Reply