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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.