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
nemode
Forum Newbie
Posts: 12 Joined: Sat Nov 01, 2003 11:20 am
Post
by nemode » Sat Nov 01, 2003 2:55 pm
how do you put a submitted word into a variable???
$filename = 'txt/ $file .txt' ; ??
Fredix
Forum Contributor
Posts: 101 Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:
Post
by Fredix » Sat Nov 01, 2003 3:03 pm
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 » Sat Nov 01, 2003 3:21 pm
$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 » Sat Nov 01, 2003 3:23 pm
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 » Sat Nov 01, 2003 3:26 pm
yeh cheers RTT![/quote]
Fredix
Forum Contributor
Posts: 101 Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:
Post
by Fredix » Sat Nov 01, 2003 3:26 pm
$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 » Sat Nov 01, 2003 3:37 pm
nemode wrote: yeh cheers RTT!
no probs