Jump to content

php query


silasl

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/78902-php-query/
Share on other sites

Not really sure how you mean..

No PHP (why ask in a php forum? :P), 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

Link to comment
https://forums.phpfreaks.com/topic/78902-php-query/#findComment-399340
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/78902-php-query/#findComment-399349
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.