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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pratibharaut
    New Member
    • Jan 2007
    • 7

    #1

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

    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----------------
    [code=html]
    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Sample code</title>
    </head>
    <body>
    <form action="test2.x html" method="post">
    Search For:<input type="text" name="txt" value="" id="txt" size="25" />
    <input type="submit" name="submit" value="submit" />

    </form>
    </body>
    </html>
    [/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]

    ----------test2.xhtml--------
    [code=html]
    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Sample code1</title>
    </head>
    <body>

    <p align="center" > Hello <?php echo $_POST['txt']; ?></p>

    </body>
    </html>
    [/code]


    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
    Last edited by pbmods; Jun 7 '07, 01:13 PM. Reason: Added code tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    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:
    [code=apache]
    LoadModule php5_module modules/libphp5.so
    AddType application/x-httpd-php .php
    [/code]

    Comment

    • pratibharaut
      New Member
      • Jan 2007
      • 7

      #3
      Thank you for your kind reply.
      But I am using this appliaction on windows (using XAMPP).

      Will you pls tell me this for windows .

      Comment

      Working...