Click to See Complete Forum and Search --> : PHP Tags showing up on browser page
Floog
05-20-2003, 09:40 PM
I'm at the very beginning stages of teaching myself PHP.
I created an html page with a small order form on it. At the end of the order form, I put in a Submit button.
I made a .php page called processorder.php. In this page I put one php tag, as follows:
<? echo "<p>Order processed."; ?>
When I hit the Submit button on the order form html page, the results of the php script come out looking like this on my Mozilla browser:
Order processed."; ?>
Why is part of the php script showing up in my browser? And how do I correct this? I'm following along with a very recent php book and this is the tap format they use.
Thanks for your time and help.
Mike
iDxMan
05-20-2003, 09:59 PM
Have you verified that php is working?
Create a quick test page: phpinfo.php
<?php phpinfo(); ?>
If that works, then edit your page and change <? to <?php . Perhaps the short tags are off..
-r
DerekKraan
05-20-2003, 10:02 PM
Who's your host? If you don't have a host, do you have Apache compiled with PHP support?
Floog
05-20-2003, 11:01 PM
iDxMan,
Thanks for your response. I put the code into the body of an otherwise blank html page.
When I open up the html page with Mozilla browser, I see a blank page.
Is this what you intended? Is this correct?
Thanks for your help.
Mike
Originally posted by iDxMan
Have you verified that php is working?
Create a quick test page: phpinfo.php
<?php phpinfo(); ?>
If that works, then edit your page and change <? to <?php . Perhaps the short tags are off..
-r
Floog
05-20-2003, 11:04 PM
I do have apache compiled with php support, but I'm actually not running apache right now. Is apache necessary to view/test php-coded pages stored on my linux box?
Thanks for your time and input.
Mike
Originally posted by DerekKraan
Who's your host? If you don't have a host, do you have Apache compiled with PHP support?
iDxMan
05-20-2003, 11:24 PM
Yes, the blank page means that your code was not interpreted by php.
but I'm actually not running apache right now.
What are you using? Apache isn't necessarily required, but a php-enabled webserver is.
-r
Floog
05-21-2003, 12:14 AM
Well then, I guess I'll have to get Apache fired up, pronto. :-)
While learning some tags and code, all I've been doing so far is placing some simple stuff in the body of html pages and then opening up the .php file with Mozilla.
So I guess my tags need to start with <?php from now on. I can deal with that.
Thanks again. I really appreciate you taking the time to give some guidance.
Mike
Originally posted by iDxMan
Yes, the blank page means that your code was not interpreted by php.
What are you using? Apache isn't necessarily required, but a php-enabled webserver is.
-r
mrBen
05-21-2003, 07:10 AM
Originally posted by Floog
Well then, I guess I'll have to get Apache fired up, pronto. :-)
While learning some tags and code, all I've been doing so far is placing some simple stuff in the body of html pages and then opening up the .php file with Mozilla.
So I guess my tags need to start with <?php from now on. I can deal with that.
Thanks again. I really appreciate you taking the time to give some guidance.
Mike
The <?php shouldn't be necessary. Once you've fired up apache, <? should be fine.
PHP works by pre-processing the pages on the server when they are requested by someone logging on to the page. If you just view them normally, nothing will happen, as the PHP interpreter(?) will not be invoked.
iDxMan
05-21-2003, 09:49 AM
Originally posted by mrBen
The <?php shouldn't be necessary. Once you've fired up apache, <? should be fine.
That is if short_open_tag in the php.ini is on. Typically it is on, but it could be off. Its also good coding style to use the full <?php tag for xml compliance.
-r
Floog
05-21-2003, 10:04 AM
Ahh, I see. Thanks for your reply, MrBen.
So, I haven't been properly viewing my processorder.php page containing the php tag.
Also, I'm going to check out my php.ini file for the short tag setting that iDxMan was talking about.
{{See what happens when you just start blindly following along with a commercial instruction book without reading the basic docs. that come with php or any other open source application.......I should know better by now.}}
Thanks again for your input.
Mike
Originally posted by mrBen
PHP works by pre-processing the pages on the server when they are requested by someone logging on to the page. If you just view them normally, nothing will happen, as the PHP interpreter(?) will not be invoked.