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.

while($disp=mysql_fetch_array($disp_de))
{           
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id=\"desc\">".$dis."</p>";
echo '</td></tr>';
}

Recommended Answers

it would be easier to see the problem if you posted more of your code.

Jump to Post

How about giving each item a unique id? Just add an extra variable:

$count = 0;
while($disp=mysql_fetch_array($disp_de))
{           
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id=\"desc".$count."\">".$dis."</p>";
echo '</td></tr>';
$count+=1;
}
Jump to Post

All 7 Replies

it would be easier to see the problem if you posted more of your code.

mm..there's eveything in the page that i had provided above.

How about giving each item a unique id? Just add an extra variable:

$count = 0;
while($disp=mysql_fetch_array($disp_de))
{           
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id=\"desc".$count."\">".$dis."</p>";
echo '</td></tr>';
$count+=1;
}

How about giving each item a unique id? Just add an extra variable:

$count = 0;
while($disp=mysql_fetch_array($disp_de))
{           
echo '<tr><td>';
$dis= $disp['pp_desc'];
echo "<p id=\"desc".$count."\">".$dis."</p>";
echo '</td></tr>';
$count+=1;
}

Thanks Nick, i think you provided a good solution. But it doesn't work for me. Do you know about javascripts? Because I don't really good in that, but i think that maybe should modify something in the function init() there, can you help me about this? for the moment, i'm using the

makeEditable('desc');

inside the function, but there's another suggestion that suggested by others in the comments part of the page, they put

for(i=1; i<max; i++){
makeEditable('item_'+i ; );
}

inside the function init() of the sditinplace.js. But it can't work in my case, I don't know why, please guide me. Thanks a lot.

Do you know about javascripts?

No.

Maybe you should ask this question in the javascript/ajax forum to get some meaningfull responds.

Nick, thanks for your advice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.