473,626 Members | 3,183 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can i make one value to many option ?

34 New Member
1. let say my table in MySQL have a column call NUMBER. In this column it would be value 1,2,3. Now i want to make the 1,2,3 as option to user to choose.
what the code should be?

2. is it this code is right?
<Select NAME="field2">
<Option VALUE='NUMBER'> 1</Option>
<Option VALUE='NUMBER>2 </Option>
</Select>
Sep 27 '06 #1
12 2012
ronverdonk
4,258 Recognized Expert Specialist
If you want to populate these fields from the database, you have to do that differently. But basically, the code you presented should be (for 3 numbers)
(the value= is passed to your form, the value between > and < is displayed to the user).
[HTML]
<Select NAME="field2">
<Option VALUE='1'>Numbe r 1</Option>
<Option VALUE='2'>Numbe r 2</Option>
<Option VALUE='3'>Numbe r 3</Option>
</Select>[/HTML]

Ronald :cool:
Sep 27 '06 #2
Sheau Wei
34 New Member
If you want to populate these fields from the database, you have to do that differently. But basically, the code you presented should be (for 3 numbers)
(the value= is passed to your form, the value between > and < is displayed to the user).
[HTML]
<Select NAME="field2">
<Option VALUE='1'>Numbe r 1</Option>
<Option VALUE='2'>Numbe r 2</Option>
<Option VALUE='3'>Numbe r 3</Option>
</Select>[/HTML]

Ronald :cool:
thank you for your reply. now i have another question is that i had generate the hyperlink as the code last time i get from this forum.


while($result = mysql_fetch_arr ay( $data ))
{

echo "<tr><td><a href='Informati onPage.php?id={ $result['ID']}'>{$result['ID']}</a></td>
<td>{$result['Name']}</td>
<td>{$result['Brand']}</td>
</tr>";

i want the user click to the ID and then it will go to another page and display the information corresponding to the ID. I am sucess to make the hyperlink.But i dont know the coding to display the information to user when user click to the ID hyperlink.Can u help me?Thank you
Sep 27 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
You lost me now. Does this last question have to do with:

1. usage of the select (drop-down) list as discussed in his thread, where you want a dynamic link in the drop down box?
2. another (previous) thread you posted and got an answer see how to generate hyperlink for entire number column of number ID ....
3. this is an entirely new question

Please reply.

Ronald :cool:
Sep 27 '06 #4
Sheau Wei
34 New Member
You lost me now. Does this last question have to do with:

1. usage of the select (drop-down) list as discussed in his thread, where you want a dynamic link in the drop down box?
2. another (previous) thread you posted and got an answer see how to generate hyperlink for entire number column of number ID ....
3. this is an entirely new question

Please reply.

Ronald :cool:
1.no.this does not do with the select list as discussess in this thread
2.this is about the queastion how to generate hyperlink for entire number of ID.
Sep 27 '06 #5
Sheau Wei
34 New Member
You already have a number of data fields in the table from which you can click. What fields do you want to display on the new page? And do you pass these values from the 'clickable link' ID page to the new page or do you want to pass the ID to the new page and read more data from the MySql database to display at the new page?

Ronald :cool:
the field i want to displa in new page is DateReceive, Quantity, Price, Status and Location. I wan to pass the ID to new page and read more data from MySql database to display at new page.
Sep 27 '06 #6
ronverdonk
4,258 Recognized Expert Specialist
You already have a number of data fields in the table from which you can click. What fields do you want to display on the new page? And do you pass these values from the 'clickable link' ID page to the new page or do you want to pass the ID to the new page and read more data from the MySql database to display at the new page?

To speed up this discussion I will assume the latter. So your calling table was generated like this:
[php]echo "<tr><td><a href='AnotherPa ge.php?id={$res ult['ID']}'>{$result['ID']}</a></td>
<td>{$result['NamaPeralatan']}</td>
<td>{$result['Motor']}</td>
<td>{$result['Operasi']}</td>
</tr>";
[/php]

The AnotherPage.php looks like this:
[php]
<?php
// check if id is passed to this routine
if (isset($_GET['id']) {
// if yes: remove harmful tags and save the passed id in variable $id
$id = strip_tags($_GE T['id']);
// now you can do your MySql functions (sample)
// connect to server .....
// connect to data base .....

// construct SQL statement
$sql = "SELECT field1, field2, ... from table_name WHERE ID='$id'";
// execute the select
}
else { // id not passed to this function
echo "Id was not passed to this routine";
die;
}
[/php]

Ronald :cool:
Sep 27 '06 #7
Sheau Wei
34 New Member
You already have a number of data fields in the table from which you can click. What fields do you want to display on the new page? And do you pass these values from the 'clickable link' ID page to the new page or do you want to pass the ID to the new page and read more data from the MySql database to display at the new page?

To speed up this discussion I will assume the latter. So your calling table was generated like this:
[php]echo "<tr><td><a href='AnotherPa ge.php?id={$res ult['ID']}'>{$result['ID']}</a></td>
<td>{$result['NamaPeralatan']}</td>
<td>{$result['Motor']}</td>
<td>{$result['Operasi']}</td>
</tr>";
[/php]

The AnotherPage.php looks like this:
[php]
<?php
// check if id is passed to this routine
if (isset($_GET['id']) {
// if yes: remove harmful tags and save the passed id in variable $id
$id = strip_tags($_GE T['id']);
// now you can do your MySql functions (sample)
// connect to server .....
// connect to data base .....

// construct SQL statement
$sql = "SELECT field1, field2, ... from table_name WHERE ID='$id'";
// execute the select
}
else { // id not passed to this function
echo "Id was not passed to this routine";
die;
}
[/php]

Ronald :cool:
i had try following your step but still the parse error at line
$id = strip_tags($_GE T['id']);
the parse error mention that it was unexpected T_VARIABLE .
Sep 27 '06 #8
Sheau Wei
34 New Member
i had try following your step but still the parse error at line
$id = strip_tags($_GE T['id']);
the parse error mention that it was unexpected T_VARIABLE .
i am very sorry Ronald. Juz now i make some mistaken in typing and causee error. Now i can can run it already . I think i cant success in my program without ur help. thank you very much .
Sep 28 '06 #9
Sheau Wei
34 New Member
i am very sorry Ronald. Juz now i make some mistaken in typing and causee error. Now i can can run it already . I think i cant success in my program without ur help. thank you very much .
After following your instruction i had sucess reach what i want to create. now i have another new question is that if i have display a table , how can i create an edit button to edit the content in the table ? Let say below was my table .


$information=my sql_fetch_array ($sql);
echo "<table border='1'>";
echo "<tr><td Name</th><td >Brand</th></tr>";

echo"<tr><td>{$ information1['Name']}</td>
<td>{$informati on1['Brand']}</td>;
echo "</table>";
Sep 28 '06 #10

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

Similar topics

1
1991
by: Antonio D'Ottavio | last post by:
Good morning, I've a problem with a dropdownlist located inside any row of a datalist, I fill both datalist and dropdownlist at runtime, the problem is with the dropdownlist infact using the event OnItemDataBound I can fill it but it is impossible for me to load the right selectedItem.Value , infact looking at the html page produced by the server I've this strange code : <select name="MyDataCampi:_ctl1:ComboTipoPartita"...
5
1993
by: Novice Computer User | last post by:
Hi. Can somebody PLEASE help. Here is a .php script. Right now, the minimum amount of time (i.e. duration) allowed is 1 month. However, I want to be able to reduce the minimum amount of time to 2 days (i.e. 48 hours). Can somebody PLEASE PLEASE tell me what I need to change in this file to do this? Here is a copy - thanks enormously in advance: <html> <head>
3
3337
by: ANTISPAM_garycnew_ANTISPAM | last post by:
What is the simplest way to retain the last option value selected in an html select object using javascript? I am currently using a server-side cgi language to accomplish this task, but it adds a lot of overhead and I would like to move the overhead to the remote client's PC, using javascript. Thank you for your assistance. Respectfully,
6
4864
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
14
3514
by: GabrielESandoval | last post by:
I need to make a registration page for a community service volleyball tournament our organization is doing. I am VERY NEW to ASP. Would the easiest way to make it be just doing it on frontpage (where i just lay out the form and save it as an .ASP file) and then changing the form properties so that the results are sent to the access file? I read that you could make aso forms on frontpage and it just seemed too easy. Do these really work...
2
2083
by: Thad | last post by:
In the html I have a select option. I am trying to get the result of the selection(u5503_qty*5) to print after some text. I am having a problem grabbing the value of u5503_qty from the html to use in the javascript. Can somebody correct me on this? Step 4. How many would you like?<br /> <select name="u5503_qty" size="1"> <option label="1" value="1" selected>1</option> <option label="2" value="2">2</option>
12
12126
by: Doogie | last post by:
How do I make a value the default value for a combo box in ASP 3.0? What I have below does NOT work, yet I've seen it in HTML file examples before (and works if I put it in a HTML file by itself, but not if I use it in a ASP 3.0 app. <select name="cboCompany" style="text-align:right; font-size:8pt"> <option value="08">08</option> <option value="09" selected="true">09</option> <option value="33">33</option>
1
2592
by: kang jia | last post by:
hi currently i am editing signup page, when user enter deupicated NRIC and click signup, they will go to do_signuppage and read the error message and then after 5 seconds, they will be redirected to signup page again, however, this time they go back, all the correct value will be remain. how should i achieve this. my current code for singup.php is like this <html> <head> <link rel="stylesheet" type="text/css" href="gallery.css" />
1
47440
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8265
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4197
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.