+ Reply to Thread
Results 1 to 2 of 2

Thread: How to insert variable html into php

  1. #1
    Barn Newbie evdv is an unknown quantity at this point evdv's Avatar
    Join Date
    Jan 2009
    Posts
    1
    Rep Power
    4

    How to insert variable html into php

    Hi... I'm a newbie and I was wondering how you insert variable html into php?

    I was impressed by this example:

    (URL Removed: New members are not allowed to post links)

    What happens here is, you fill in a variable URL in the webform and the content of that website appears in your own site (using a frame).

    I wondered how I could do this...?

    I'm pretty good in html but newbie with php. Actually I'm a Drupal user.

    It would be so great to receive some usefull information. Thanks!

    Evdv

  2. #2
    Moderator don94403 is a jewel in the rough don94403 is a jewel in the rough don94403 is a jewel in the rough don94403's Avatar
    Join Date
    Mar 2008
    Location
    San Mateo, CA, USA
    Posts
    313
    Blog Entries
    8
    Real Name
    Don Ravey
    Rep Power
    6

    Can't help you with Drupal, but here's the new thinking you need to develop: PHP is entirely different from HTML because PHP is only meaningful on the server, before anything is sent to the browser. Your web server (Apache or IIS) parses any PHP contained in a file and generally outputs HTML (and perhaps Javascript) to the browser. The PHP is no longer part of what the browser sees.

    So when you ask how to insert PHP into HTML, that doesn't mean much. What you do is to use PHP to determine what HTML to send to the browser.

    You can either use PHP's echo (or print) commands to send whatever you want--HTML or Javascript or whatever--to the browser, or you can mix PHP into your HTML where you need to insert some variable bit of HTML or plain text or whatever. Whenever the web server sees <?php it begins parsing the PHP until it sees ?>.

    So, you can do something like this:
    PHP Code:
    ...
    <table>
       <tr>
          <td>Hello World</td>
       </tr>
    <?php
       
    if($_GET['mydata']=='romeo') {
          echo 
    "<tr><td>Hello, Romeo</td></tr>";
       }
    ?>
    </table>
    ...

+ Reply to Thread

Similar Threads

  1. Session variable not querying??
    By Centurion in forum ASP Development
    Replies: 7
    Last Post: December 3rd, 2008, 11:35 AM
  2. INSERT-SELECT errors
    By moonflower333 in forum Microsoft SQL Server
    Replies: 5
    Last Post: November 4th, 2008, 06:43 PM
  3. Help with handling sql insert error
    By Rebelle in forum ASP Development
    Replies: 11
    Last Post: August 29th, 2008, 02:20 PM
  4. can not insert duplicate key
    By guddu in forum Microsoft SQL Server
    Replies: 1
    Last Post: August 20th, 2008, 10:27 AM

Bookmarks

Posting Permissions

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

SEO by vBSEO