silasl Posted November 26, 2007 Share Posted November 26, 2007 Hi all, Would appreciate any help with a small php problem. I would like to know if it's possible to retrieve the copy within an html element using php. Specifically i'd like to have a script that read the contents of a <p></p> tag with the id 'title' and saved it as a variable. there can be no .php within the html itself. Is this possible or is there a better way of going about it? Thanks in advance, Si Quote Link to comment https://forums.phpfreaks.com/topic/78902-php-query/ Share on other sites More sharing options...
helraizer Posted November 26, 2007 Share Posted November 26, 2007 Not really sure how you mean.. No PHP (why ask in a php forum? ), or did I misunderstand? Javascript, perhaps. Along the lines of. var pval = new array() pval[0] = document.getElementById('title').value; for (i=0; i<pval.length; i++) { document.write(pval[i] + " <br /> " ) } but that would only work if the tag was like '<p id="title" value="value here"></p>' not '<p id="title">value here</p>' then it'd output to the screen 'value here'. Other than that I think you need PHP Quote Link to comment https://forums.phpfreaks.com/topic/78902-php-query/#findComment-399340 Share on other sites More sharing options...
silasl Posted November 26, 2007 Author Share Posted November 26, 2007 Hi, thanks for your response. Maybe i didn't explain very well... i'd like to use .php but it can't interfere with any of the html. Basically i'm creating a breadcrumb generator for a company intranet where all the content is generated in hard copy using a set of html templates, (a whole different issue...), by various company employees. So i'd like to be able to use a .php script that i can just add as an include to the template that will finish the breadcrumb trail by reading whatevers the title of the page - <p id="title">title</p> and displaying it. Is that any clearer...? Cheers, Si Quote Link to comment https://forums.phpfreaks.com/topic/78902-php-query/#findComment-399349 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.