473,386 Members | 1,766 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,386 software developers and data experts.

select option


I want to load textarea's value in drop-down box.
In first page, such form is existed.
<form name="form1" method="post" action="next.php">
<textarea name="dayList" Id = "dayList" cols=20
rows=10></textarea>
</form>

in text area there's one column of values.
in "next.php", put values of 'dayList' in select option. I made a code
by myself. However, as you see, it's just nonsense. How can I modify
this? Thank you!

<?php
$value=(int)$_POST['dayList'];
?>

<select name="dateList" id="dateList" >
<?php
echo '<option value="1">' .$value '</option>';
?>
</select>

Oct 19 '06 #1
1 2777
kirke wrote:
<form name="form1" method="post" action="next.php">
<textarea name="dayList" Id = "dayList" cols=20
rows=10></textarea>
</form>

in text area there's one column of values.
in "next.php", put values of 'dayList' in select option. I made a code
by myself. However, as you see, it's just nonsense. How can I modify
this? Thank you!

<?php
$value=(int)$_POST['dayList'];
?>
$_POST['dayList'] is a list of lines, not an int!
You want to convert a group of lines into an array.

<?php
$value = explode("\n", $_POST['dayList']);
?>
<select name="dateList" id="dateList" >
<?php
echo '<option value="1">' .$value '</option>';
?>
</select>
<select name="dateList" id="dateList">
<?php
foreach ($value as $k=>$v) {
echo '<option value="', $k, '">', $v, '</option>';
}
?>
</select>

--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Oct 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that...
4
by: point | last post by:
Hello there... I'm a PHP programmer and starting to learn JS... I have a following problem.... I have 3 select boxes! one is hotel one is destination and one is country... if someone...
3
by: gekoblu | last post by:
Hi!, I want to fix via javascript the combo width to a fix value. I'd like to implement a kind of ALT / TITLE function to show the entire option when the text is longer than the combo width......
4
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
5
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list...
9
chunk1978
by: chunk1978 | last post by:
hey everyone, i've been trying to solve this problem for 2 days straight, with no end in sight. i would greatly appreciate anyone's help. EXPLANATION: There are 3 Select Menus. The 1st and...
7
by: srt5k | last post by:
I have a web page with 2 html multiple select boxes on it, and I use javascript to dynamicaly copy options from one box to another, before deleting the option from the first box. My issue is...
2
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php"...
2
by: Sudhakar | last post by:
i have two select tags as part of a registration form, city1 city2 where city1 has a list of regions and similar for city2 there are different regions for city1 and city2 so instead of all the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.