473,468 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to do the multiple items with the same id?

17 New Member
Hi all,
I'm having the problem while using the edit-in-place scripts from internet. It's ok when i just used for one text id, but after i added a while loop because of multiple items and it become only the 1st text id content works. So below here i post a piece of my code, hope any here can help on this. How to do the multiple items with the same id? Please help. Thank you very much.

[PHP]while($disp=mysql_fetch_array($disp_de))
{
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id=\"desc\">".$dis."</p>";
echo '</td></tr>';
}[/PHP]
Mar 2 '08 #1
5 2393
Markus
6,050 Recognized Expert Expert
You can't dop multiple items with the same id; they're intended t be unique.

And also, thanks!
I've been looking for something like this :P
Mar 2 '08 #2
littlegreen
17 New Member
hi, ic but do you know how to solve this? Because I need it to be display and editable in place. But since that can't be same id then does it have any other choices to do this? for example, like flickr. It can be edited after one click although with multiple editable id or whatever...do you know this? Thanks.
Mar 3 '08 #3
Markus
6,050 Recognized Expert Expert
Through the onclick of an element you could pass the id of said element to the javascript function.
Expand|Select|Wrap|Line Numbers
  1. function editable(elementID, otherVars)
  2. {
  3. // code 
  4. }
  5.  
Expand|Select|Wrap|Line Numbers
  1. <p id="something" onclick="editable(this, something_else)">
  2. sdsfsdf</p>
  3.  
Mar 3 '08 #4
littlegreen
17 New Member
thanks, I'll try but i don't really god in javascripts.
Mar 3 '08 #5
ronverdonk
4,258 Recognized Expert Specialist
thanks, I'll try but i don't really god in javascripts.
In order to make your ID's unique is to use a sequence counter and concat that to the name 'desc', so in your code e.g.[php]$i=0;
while($disp=mysql_fetch_array($disp_de))
{
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id='desc".$i."'>$dis</p>";
echo '</td></tr>';
$i++;
}[/php]
Most likeable success on JavaScript help with problems is in the JavaScript forum.

Ronald
Mar 3 '08 #6

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

Similar topics

3
by: jason | last post by:
How does one loop through the contents of a form complicated by dynamic construction of checkboxes which are assigned a 'model' and 'listingID' to the NAME field on the fly in this syntax:...
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. ...
2
by: Peter | last post by:
Hello! Please, could anyone tell, is it possible to set multiple items to be selected in list control in the code? For example when the web form is loaded three items of 5 are selected in list...
1
by: sab | last post by:
Hi, We have a web form with a listbox. The listbox is a multiple select listbox and has data that looks something like: ALL Unit 1 Unit 2 Unit 3 Note: "ALL" is always the first item in...
1
by: sneha123 | last post by:
There will be some 20 questions and for each question there will be 4 choices.what i want to do is to select multiple answers by clicking the checkbox. i m using asp.net,vb.net pls help me we...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
2
by: anchi.chen | last post by:
Hi People, Just wondering if any of you have ever come across any javascript examples that will allow one to drag and drop multiple items between lists? That is, users would be able to use the...
10
by: kimiraikkonen | last post by:
Hi, I have an app which has a listbox and when i double click an associated fileS, i want their paths to be added into listbox in my application. This code works good when i try to open a...
4
by: swethak | last post by:
hi i wrote a code to select multiple items in a drop down list.And i store all the items in my database.But in that i select multiple items and submit that items last item only stored.Please...
25
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.