Page 1 of 1
submit into a variable
Posted: Sat Nov 01, 2003 2:55 pm
by nemode
how do you put a submitted word into a variable???
$filename = 'txt/ $file .txt' ; ??
Re: submit into a variable
Posted: Sat Nov 01, 2003 3:03 pm
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
Posted: Sat Nov 01, 2003 3:21 pm
by RTT
$filename = 'txt/'.$file;
(where $file might be $_POST['file'] or $_GET['file'])
Posted: Sat Nov 01, 2003 3:23 pm
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??
Posted: Sat Nov 01, 2003 3:26 pm
by nemode
yeh cheers RTT![/quote]
Posted: Sat Nov 01, 2003 3:26 pm
by Fredix
$filename = "txt/".$_POST['input_field_name'].".txt";
so difficult?
Posted: Sat Nov 01, 2003 3:37 pm
by RTT
nemode wrote:yeh cheers RTT!
no probs
