tags:

views:

26

answers:

2

hello I'm new to PHP programming and I migrated from ASP .net to PHP..

I have a div just like below

<div id="mydiv"></div>

what I wanted to do is just to change the text and html content(like some name or any data in it) in it.

What I imagine is just like

mydiv=>innertext="some value";

Thanks, GURU

A: 

Are you trying to modify the div in the same page as the php? I don't think that's possible.

PHP runs at the server, and only sees content between the php tags.

If you're modifying dom content, it seems like javascript/jQuery is a better approach for this.

Otherwise, if you're modifying content that is hosted already, and plan output it to a different page, then you can use this:

PHP Simple HTML DOM Parser

Alan
Thanks for your information Alan,i appreciate you.Thanks again.Guru
Guru
I appreciate you as well.
Alan
A: 

$myDivText = "This is what goes inside mydiv";

echo "<div id=\"mydiv\">$myDivText</div>";

greenjambi
Thanks for your information but I couldn't got your means.Though I've already got a right answers, anyways thanks again for taking interest in my query.:)
Guru