473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

HTML: how to assign an array to <option value=...>?

Hello,

I am new to HTML and PHP. And I am trying to assign an array of values to the
<option value=...> of a combo list. But what I am trying to do is not working. I
can sucessfully get it to work if I assign each value separately.

I wonder if anyone could please help me with this problem. Below is my code.

Thank you and Best Regards,

Akino.
----------------------------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. <html>
  2.    <head>
  3.       <title>Testing testing...</title>
  4.    </head>
  5.  
  6. <?php
  7.    $time = array("Morning", "Afternoon", "Night");
  8. ?>
  9.    <body style="padding-left:48pt">
  10.       <form id="subForm" name="subForm" method="post">
  11.          <b>Select your favorite time of day :</b><br/>
  12.          <select name="ToD" size="1">
  13. <!--
  14.             <option value="Morning">Morning</option>
  15.             <option value="Afternoon">Afternoon</option>
  16.             <option value="Night">Night</option>
  17. -->
  18.              <option value="<?php $time ?>"></option>
  19.          </select><br/<br/>
  20.       </form>
  21.    </body>
  22. </html>
  23.  
Mar 11 '09 #1
2 7522
drhowarddrfine
7,435 Expert 4TB
You should ask PHP questions in the PHP forum.
Mar 11 '09 #2
Dormilich
8,658 Expert Mod 8TB
you could try the foreach loop.
Mar 11 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
$successMsgArray = array('image' => array('add_album' => 'Album: "$album" has been created', 'edit_album' => 'Information for album "$album" has been changed')); I am having to return the...
8
by: Mike S. Nowostawsky | last post by:
I tried using the "toUpperCase()" property to change the value of an array entity to uppercase BUT it tells me that the property is invalid. It seems that an array is not considered an object when...
8
by: Sergei | last post by:
Hi, I am displaying modal dialog and passing values from the main form to the modal dialog and back. It works fine but if I used the following syntax on Page_Load(just for testing) in VB to...
0
by: JJ_377 | last post by:
The following doesn't assign value to the dropdownlist - WHY? ___________________________________________________________________ In a user control (ascx named USACustomer) : Public Property...
0
by: gladiator | last post by:
Hello Here I wrote an example by which an const variable can be assigned witha value but I can not understand how can it assign value. #include<stdio.h> int main(void) { const int i=10;...
4
by: harpreet1433 | last post by:
i have a arraylist what i want to do is assign value of textarea to arraylist ie arr(0)=value of textarea(in javascript) is it possible thanks
1
by: harpreet1433 | last post by:
how to assign value to a hidden field of stuts form what i actually want to do that assign it through javascript document.all.fieldname=value works well under IE and Netscape but in...
1
by: No_Spam | last post by:
I have an MS Access form attached to a table. I have a text box which has its control source set to a field in the table... However, at run time if certain things change, I want to the change the...
4
by: IRC | last post by:
hey, i am pretty new on javascript as well as PHP, Hey, anyone can you help me, how to pass the javascript array value to php page......... i want to retrieve the values which are arrayed on...
3
by: sql2020 | last post by:
Hi, i am new to windows application. I have successfully list DataGridView with contain in a table. SqlConnection conn = new SqlConnection(map); string sql = "Select * from Table_Name";...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.