Results 1 to 7 of 7

Thread: php help

  1. #1
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    252
    Tokens
    0

    Default php help

    If i want to add a script to a php page when i wanna put it somewhere, do i go
    <script> php here </script> Cause i do that and its not working.

    p.s first time adding scripts to my site.

  2. #2
    Join Date
    Mar 2005
    Location
    Leeds
    Posts
    3,423
    Tokens
    0

    Latest Awards:

    Default

    You can close the PHP tags or you can use a echo

    PHP Code:
    <?php
    // My 1st PHP code
    ?>
    <script></script>
    <?php
    // My 2nd PHP code
    ?>
    PHP Code:
    <?php
    echo("<script></script>");
    ?>
    You cant use " in the echo tag

  3. #3
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Unless you use ' when the echo uses " or vice versa. or slash out the " or ' s or use a more advanced echo method so as to avoide the problem all together "/

  4. #4
    Join Date
    Dec 2004
    Location
    Manchester, UK
    Posts
    334
    Tokens
    0

    Default

    e.g.

    Code:
    <?php
    echo ("This is text<font face=\"verdana\" size=\"2\">This would make the font Verdana Size 2</font>") 
    ?>
    Last edited by Robbie..; 03-04-2006 at 09:25 PM.

  5. #5
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    What are you trying to do? Add PHP to the site, or are you trying to add JavaScript using PHP?
    To add PHP to the site:
    PHP Code:
    <?php
    #PHP here..
    ?>
    To add JavaScript, just place the script tag outside of the PHP tag. If you're trying to add dynamic content though, you'll just need to print the JavaScript tag.
    Example:
    PHP Code:
    <?php
    $date 
    date("l \- jS");
    print 
    '<script type="text/JavaScript">alert(\'The date is: '.$date.'\');</script>';
    ?>

  6. #6
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    252
    Tokens
    0

    Default

    Im trying to add a poll i got everything uploads and did the stuff then i have to add its to a box on my site so then i get a code and i put it in but it doesnt work..
    im noob at php

  7. #7
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    252
    Tokens
    0

    Default

    i have to include this script in a php page \
    PHP Code:
    <?
    include("dynamicpoll/poll.php");
    ?>
    How do i get it too work

Posting Permissions

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