Re: adding items to a list or menu
| From: | (Robert) | Date: | Tue, 06 Apr 2004 05:24:21 +0000 |
| Subject: | Re: adding items to a list or menu | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-183125@lists.php.net to get a copy of this message | ||
"R.G. Vervoort" <roy.vervoort@royvervoort.nl> wrote in message news:<40719bfc$0$563$e4fe514c@news.xs4all.nl>...
> Not sure if it is a php question but since i am working in php here it is.
>
> Ho can i add items to (the item label=visual text and the value=index
> number) a list object on a website.
>
> I am having a list with 4 items and i would like to add the text from a
> textfield (textfield1.value) to the list object so it will hold 5 items.
>
> thanks for any suggestions
>
> Roy
> The Netherlands
PHP is server side, it looks like you want to send items to a client
side app (javascript?) you could do something like this:
--->Snip!
<?php
$array = array('item1', 'item2', 'item3', 'item4'); //I use
an array
here for simplicity, you could do the same with a dB query or the like
echo "<html>\n<head></head><!--javascript-->"; //Not a javascript
guy,
but you get the point
foreach($array as $key=>$item) {
echo "\n textdata.item$key=$item";
}
?>
<body> etc.....
<---
Not sure how javascript looks (started working with it in last 2 days)
but you can change that echo statement to what it should be in
javascript
Cheers!
Robert