Re: [PHP] using a text file for variables in a form?
The HTML would be having problems because PHP would compile this: -- ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? -- as: -- INPUT TYPE=TEXT NAME=savings VALUE=' -- Note VALUE's quotes: and '. Try with this: -- ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . ''; ? -- Alexis N. Mueller [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Dan, Thanks for replying so fast.. I tried it out right away. The script part of it didn't seem to give me much grief, however the html part of it seems to be having issues with the combination of single quotes (') and double qouotes (), or maybe it's the order, or a linebreak in the email... i don't know... ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] using a text file for variables in a form?
Alex- This is very basic PHP. I have some variables stored in plain text in a text file. Unfortunately I am not going to be able to use SQL to solve this one, since that server is not running it. Anyway. The text file looks like this (everything between the *): * SAVINGS=type1 FILTER=disabled SPOOL=category1 * I use a form to edit this text file. SAVINGS and SPOOL are 'select' form items with multiple options. FILTER is a 'radio' form item with two options. I was wondering if anyone knew how to make the text file pass the variables into the form that i use to edit the text file... confusing? First, you need to get the data from the file and make the items useful: ? $ary = file(myfile.file); foreach($ary as line) { # break up the line list($key,$value) = explode(=,$line); # Take off that pesky newline $value = substr($value,0,-1); $data[$key]=$value; } ? Now your values are accessible as $data[SAVINGS], etc. So... when building the HTML... ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? Daniel J. Lashua -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] using a text file for variables in a form?
Dan, Thanks for replying so fast.. I tried it out right away. The script part of it didn't seem to give me much grief, however the html part of it seems to be having issues with the combination of single quotes (') and double qouotes (), or maybe it's the order, or a linebreak in the email... i don't know... ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? Also this solution provides a text box... I'm sure I can play around with making it an 'option' within a 'select' item of a form... like: ? print select size=1 name=SAVINGS print option name=SAVINGS VALUE=foo; ? please lemme know if i'm understanding this right... thanks -Alex Daniel [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Alex- This is very basic PHP. I have some variables stored in plain text in a text file. Unfortunately I am not going to be able to use SQL to solve this one, since that server is not running it. Anyway. The text file looks like this (everything between the *): * SAVINGS=type1 FILTER=disabled SPOOL=category1 * I use a form to edit this text file. SAVINGS and SPOOL are 'select' form items with multiple options. FILTER is a 'radio' form item with two options. I was wondering if anyone knew how to make the text file pass the variables into the form that i use to edit the text file... confusing? First, you need to get the data from the file and make the items useful: ? $ary = file(myfile.file); foreach($ary as line) { # break up the line list($key,$value) = explode(=,$line); # Take off that pesky newline $value = substr($value,0,-1); $data[$key]=$value; } ? Now your values are accessible as $data[SAVINGS], etc. So... when building the HTML... ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? Daniel J. Lashua -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] using a text file for variables in a form?
The script part of it didn't seem to give me much grief, however the html part of it seems to be having issues with the combination of single quotes (') and double qouotes (), or maybe it's the order, or a linebreak in the email... i don't know... ? print 'INPUT TYPE=TEXT NAME=savings VALUE=' . $data[SAVINGS] . '; ? Yeah. I typoed. It is just BASIC outputting of HTML, though. You can do it a million different ways. If you wanted to do it my way... you should use this: ? print 'INPUT TYPE=TEXT NAME=savings VALUE='; print $data[SAVINGS]; print '; ? but... of course it takes MUCH more than that to have anything working. You need FORM tags, and a PHP script to accept the submission, etc, etc. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]