[PHP] using a text file for variables in a form?

2002-01-24 Thread Alexis N. Mueller

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?
hmm...
let's say i was editing the text file that i gave as an example, I would
like like the SAVINGS 'select' field in the form to have type1 selected. the
FILTER 'radio' field
in the form should be checked on disabled. And the SPOOL 'select' field
should read category1

Anyone have any ideas on how to do that?
Help would be appreciated,
Thank you

Alex



-- 
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?

2002-01-24 Thread daniel

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:



Now your values are accessible as $data["SAVINGS"], etc.

So... when building the HTML...

";
?>



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?

2002-01-24 Thread Alexis N. Mueller

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...

";
?>


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 "";
?>

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 '";
> ?>
>
>
>
> 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?

2002-01-24 Thread daniel

> 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 '";
> ?>

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:

";
?>

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]




Re: [PHP] using a text file for variables in a form?

2002-01-26 Thread qartis

The HTML would be having problems because PHP would compile this:

--
";
?>
--

as:

--
';
?>
--

"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 '";
> ?>
>
> 



-- 
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]