Results 1 to 2 of 2

Thread: running PHP in HTML

  1. #1
    Junior Member
    Join Date
    Jul 2011

    running PHP in HTML

    Dear friends,

    I have created a html page with dynamic select boxes and included the below line in the form.

    HTML Code:
    <form action="sqlpage.php"target="_blank" method="post">
    The mentioned sqlpage.php contains some php code with head,body and html tags which connects to MySQL DB and search for queries and displays the results on a webpage.

    But when i run the html page and enter search terms in the query box and click search it directs to this sqlpage and i don't see any results but the php code is displayed as it is on the page. But when i run the page as http:localhost/sqlpage.php it gives perfect results. I guess there is some misinterpretation between html and php.

    I would be thankful if someone help me in this matter.

    Thanks in advance.

    Kind Regards

  2. #2


    First if you copied and pasted this

    <form action="sqlpage.php"target="_blank" method="post">

    You are missing a space before the target="".

    Generally (and I am no PHP guru) when I make a query to a database, the php code is on the same page above the HTML. When you set up a target and an action, it will direct to that page. Easiest solution would be to change your HTML page to a .php extension, and place the php code over html like below.

    <?php enter your code in here ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    Hope that helps 8)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts