Page 1 of 1

all html code is not showing by the view source

Posted: Sun Jul 25, 2010 3:07 pm
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.

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

Posted: Sun Jul 25, 2010 3:18 pm
by oscardog
It should appear perfectly fine in view source. Always has for me!

Care to share a link to the site?

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

Posted: Sun Jul 25, 2010 3:56 pm
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

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

Posted: Sun Jul 25, 2010 4:12 pm
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.

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

Posted: Sun Jul 25, 2010 4:16 pm
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.

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

Posted: Sun Jul 25, 2010 8:46 pm
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.

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

Posted: Mon Jul 26, 2010 12:25 am
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.