By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,061 Members | 506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,061 IT Pros & Developers. It's quick & easy.

Error occurs in XHTML pages when i write php code inside it

P: 7
Hello friends,

I am trying to make XHTML pages with PHP . But when i write the php code it doesnt work. It works for plain XHTML.
For run that pages i am using WAP Proof software.

The code is here

--------------test.xhtml----------------
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html
  2. PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html>
  5. <head>
  6. <title>Sample code</title>
  7. </head>
  8. <body>
  9. <form action="test2.xhtml" method="post">
  10.       Search For:<input type="text" name="txt" value="" id="txt" size="25" />
  11.       <input type="submit" name="submit" value="submit"  />
  12.  
  13.   </form>
  14. </body>
  15. </html>
  16.  
[Please use CODE tags when posting source code. Thanks! --pbmods]

----------test2.xhtml--------
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html
  2. PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html>
  5. <head>
  6. <title>Sample code1</title>
  7. </head>
  8. <body>
  9.  
  10.     <p align="center" > Hello <?php echo $_POST['txt']; ?></p>
  11.  
  12. </body>
  13. </html>
  14.  

When I run test.xhtml file then following message occurs

" Binary data (application/octet-stream)
Click "Open in Shell" button to open " .

When i click on open in shell button then nothing happens.WAP software is not registered yet but another sample code is running properly on this WAP Proof software .

If I remove PHP tag from second code then also it works fine. Is there any settings for using the XHTML with PHP?

Pls tell where I am wrong

Thanks in advance
Pratibha
Jun 7 '07 #1
Share this Question
Share on Google+
2 Replies

pbmods
Expert 5K+
P: 5,821
You need to configure your webserver to parse PHP files and serve them as web pages.

If you're using Apache on Mac or Linux, add the following lines to your httpd.conf file:
Expand|Select|Wrap|Line Numbers
  1. LoadModule php5_module        modules/libphp5.so
  2. AddType application/x-httpd-php .php
  3.  
Jun 7 '07 #2

P: 7
Thank you for your kind reply.
But I am using this appliaction on windows (using XAMPP).

Will you pls tell me this for windows .
Jun 9 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.