views:

54

answers:

2

Okay, so now I am confronted with a new problem, and I just don't know what to do next.

I have a table where the contents of it is dynamically added from a database on page load, and each item in the table is a link. The link looks like this:

$ct->data[$key][3]='<a href="allthread.php?sessid='.SID.'&product='.$ct->data[$key][0].' '.$ct->data[$key][1].' '.$ct->data[$key][3].'&qty='.">'.$ct->data[$key][3].'</a>

Which is great.

But, the user is also allowed to (using ContentEditable) edit the values within the table, and when they then click the link, I need to get the NEW value of the URL with PHP. How can this be done?

Thank you

A: 

If I understand you correct, a rtegex is what you need. Look here: http://www.phpf1.com/tutorial/php-regular-expression.html

What you need should look like <a href="([^"]+)">[^<]+</a>

joni
parsing html with regex? you'd better duck! ;)
Matt Ellen
thanks joni, that wasn't what i was looking for. But my question wasn't that clear to begin with anyway. But thanks :)
lucifer
+1  A: 

Your question is not very clear, but I think you must mean extracting the edited href value from the and sending it back to the server (where PHP is running). Is that what you mean?

In that case you need to extract it with Javascript and send it with Ajax.

You need to - identify the element, either by giving them all distinct 'id' properties, or by finding them relative to some other element (using xpath or similar); or if this is triggered by an event, you can find the object the event was triggered on. - extract its 'href' property - send this to a suitable backend program on your server with Ajax.

Does this answer your question?

Colin Fine
Thank you very much, that answers my question. So, I need javascript and ajax... Do you know of any tutorials that do this around the net somewhere? :)
lucifer