all html code is not showing by the view source

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
infomamun
Forum Contributor
Posts: 102
Joined: Mon Dec 28, 2009 7:48 pm

all html code is not showing by the view source

Post by infomamun »

Hi there
I am a newbie in php and dont know much about php. The page we see by the browser, if we press "view source", all html source code should be seen. But I observed that if this is the php code-

<td><? echo "table data" ?></td>; then

in view page source option of browser shows only this- <td></td>. There is no "Table data" text in between <td> tag.

But I know the content of page we are seeing on browser should be at source code also as browser displays them from souce code. Then why html code which is produced by php echo cant be seen?

Is there any way or software to see in hidden html code? I need that for scrapping purpose. Please let me know.
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: all html code is not showing by the view source

Post by oscardog »

It should appear perfectly fine in view source. Always has for me!

Care to share a link to the site?
Thizzle
Forum Newbie
Posts: 12
Joined: Fri Jul 23, 2010 12:29 pm

Re: all html code is not showing by the view source

Post by Thizzle »

This person didn't open the PHP right...

Code: Select all

//he wrote
<td><? echo "table data" ?></td>; then

//when it should be
<td><?php echo "table data"; ?></td>
//He even added a semicolon out of the <php ?> tags
infomamun
Forum Contributor
Posts: 102
Joined: Mon Dec 28, 2009 7:48 pm

Re: all html code is not showing by the view source

Post by infomamun »

Please go to this address http://www.dsebd.org/news_archive.php. You will see one drop down menu named as "Search by Trading Code". Please view the source code of this drop down menu/form. Its method is post and action is "old_news.php". There is a select name tagged as "cbosymbol" also, but there is no value for <option> tag. Now go to the page, select a Trading code from that drop down menu and press button. The news for that particular Trading Code will be displayed.

Actually what I want, scrap the news for a particular Trading code/Company. But as I am not finding option value so unable to scrap news for a particular company. Plz tell me what trick is going on there to process the form.
infomamun
Forum Contributor
Posts: 102
Joined: Mon Dec 28, 2009 7:48 pm

Re: all html code is not showing by the view source

Post by infomamun »

@Thizle, that code was not the practical code, it was just as example. And as far I have gatherd little knowledge about php, both <?-php-?> & <?--?> have same effect and even if you place a semicolon before end tag of php, it will work well, no problem will be there to display it. I have tested it. And as I am a newbie please dont lough at me if I have asked or told a silly question. I found this forum is very active. So I want to learn from all of you buddy, please help me.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: all html code is not showing by the view source

Post by requinix »

1. If you omit a value for an <option> the default value is whatever the label shows. So

Code: Select all

<option>1STBSRS</option>
is equivalent to
<option value="1STBSRS">1STBSRS</option>
2a. While you are mostly correct, using <?php tags is the safest choice, as the shorter <? tags must be enabled in PHP in order to be used. But if they were disabled you'd see them in the HTML output.
2b. Also, the semicolon can be omitted from the last statement in a block of PHP code if a closing ?> immediately follows.
3. Where is this <? echo "table data" ?> supposed to be seen? The <option>s you pointed out don't look like they're having any problems.
infomamun
Forum Contributor
Posts: 102
Joined: Mon Dec 28, 2009 7:48 pm

Re: all html code is not showing by the view source

Post by infomamun »

Thanks tasairis for your explanatory reply. The table data I stated at first now is ok. It was my mistake. I saw the source code before pressing form's submit button. But would you help me please? I made a form using the form elements (the one you showed), but the returned page is not showing the news as website does. Instead it returns the "News Archive" page.
Post Reply