www.webdeveloper.com
Results 1 to 10 of 10

Thread: [RESOLVED] how to change html code to php

  1. #1

    resolved [RESOLVED] how to change html code to php

    how can i get the $link to display in html it work on the <?echo $link;?>
    but wont work on just the link if I try to replace the $link with <?echo $link;?> in the <a href code it does not work

    Code:
    	$link = '<a href="' . $value['url'] . '" url="' . $value['url'] . '"' . $target . '>' . $value['url'] . "</a>";
    
    ?>
    <?echo $link;?>
    
    <a href="#" onclick="return false" onmouseover="Tip('<img src=\'http://open.thumbshots.org/image.aspx?url=$link width=\'200\'>')" onmouseout="UnTip()"> 
    
    $link
    
    <?

    so how would I change the
    Code:
    <a href="#" onclick="return false" onmouseover="Tip('<img src=\'http://open.thumbshots.org/image.aspx?url=$link width=\'200\'>')" onmouseout="UnTip()">
    to php


    i tried <?echo '<a href="#" onclick="return false" onmouseover="Tip('<img src=\'http://open.thumbshots.org/image.aspx?url=$link width=\'200\'>')" onmouseout="UnTip()"> '?> but got errors

    i also posted under html just in case someone can help me there
    Last edited by winracer; 01-08-2010 at 11:03 PM. Reason: add
    Winracer
    Jack of all trades master of none
    http://www.brownlows.net

    “Only a life lived for others is a life worth while” Albert Einstein
    “The golden rule for every business man is this: 'Put yourself in your customer’s place'” Orison Swett Marden
    “No person was ever honored for what he received; honor has been the reward for what he gave” Calvin Coolidge

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    ?url=<?echo $link;?> width=
    i also posted under html just in case someone can help me there
    Please don't cross post; if a post is in the wrong forum a mod will move it.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Jul 2009
    Location
    Falls Church, Va.
    Posts
    780
    @OP

    Your errors resulted in your code because you didn't escape the single quotes you included in your echo statement wrapped by a single quote. Remember the basics, i.e. always escape quotes when wrapped by quotes (either type) and use single quotes to wrap a literal string and double quotes to wrap a string with embedded variables. Simple as that.

  4. #4
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    Instead of

    PHP Code:
    ?>
    <?echo $link;?>   <-- why switch out of php mode to echo in php mode? -->
    <?php
    I use

    PHP Code:
    echo $link

  5. #5
    Join Date
    Dec 2009
    Location
    Budapest, HUN
    Posts
    6
    $link = "\"<a href=\"" . $value['url'] . "\" url=\"" . $value['url'] . $target . "\" >" . $value['url'] . "</a>";

    ?>
    <?php
    echo $link;
    ?>

    <a href="#" onclick="return false" onmouseover="Tip('<img src=\'http://open.thumbshots.org/image.aspx?url=$link width=\'200\'>')" onmouseout="UnTip()">

    <?php echo $link; ?>

  6. #6
    Quote Originally Posted by Fang View Post
    Code:
    ?url=<?echo $link;?> width=
    Please don't cross post; if a post is in the wrong forum a mod will move it.


    sorry, this does not work

    it displays the url and this on screen/webpage

    width==\'200\'>')" onmouseout="UnTip()">


    thanks
    Winracer
    Jack of all trades master of none
    http://www.brownlows.net

    “Only a life lived for others is a life worth while” Albert Einstein
    “The golden rule for every business man is this: 'Put yourself in your customer’s place'” Orison Swett Marden
    “No person was ever honored for what he received; honor has been the reward for what he gave” Calvin Coolidge

  7. #7
    Quote Originally Posted by Dasher View Post
    Instead of

    PHP Code:
    ?>
    <?echo $link;?>   <-- why switch out of php mode to echo in php mode? -->
    <?php
    I use

    PHP Code:
    echo $link


    sorry i guess i did not explain my self


    what I need it the $link to work here or change this to php code and not html

    Code:
    <a href="#" onclick="return false" onmouseover="Tip('<img src=\'http://open.thumbshots.org/image.aspx?url=$link width=\'200\'>')" onmouseout="UnTip()">

    thanks
    Winracer
    Jack of all trades master of none
    http://www.brownlows.net

    “Only a life lived for others is a life worth while” Albert Einstein
    “The golden rule for every business man is this: 'Put yourself in your customer’s place'” Orison Swett Marden
    “No person was ever honored for what he received; honor has been the reward for what he gave” Calvin Coolidge

  8. #8
    Join Date
    Dec 2009
    Location
    Budapest, HUN
    Posts
    6
    U mean this (?):

    <?php

    echo "<a href=\"#\" onclick=\"return false\" onmouseover=\"Tip(\'<img src='http://open.thumbshots.org/image.aspx?url=$link'\' width=\"200\" >)\" onmouseout=\"UnTip()\">";

    ?>

    I'm not sure enough about the single quotes... =)

    Have a nice day! =)

  9. #9
    Quote Originally Posted by benkus View Post
    U mean this (?):

    <?php

    echo "<a href=\"#\" onclick=\"return false\" onmouseover=\"Tip(\'<img src='http://open.thumbshots.org/image.aspx?url=$link'\' width=\"200\" >)\" onmouseout=\"UnTip()\">";

    ?>

    I'm not sure enough about the single quotes... =)

    Have a nice day! =)

    thanks, this help i got it to work........ sometime the little things are the hardest
    Winracer
    Jack of all trades master of none
    http://www.brownlows.net

    “Only a life lived for others is a life worth while” Albert Einstein
    “The golden rule for every business man is this: 'Put yourself in your customer’s place'” Orison Swett Marden
    “No person was ever honored for what he received; honor has been the reward for what he gave” Calvin Coolidge

  10. #10
    Join Date
    Dec 2009
    Location
    Budapest, HUN
    Posts
    6
    Quote Originally Posted by winracer View Post
    thanks, this help i got it to work........ sometime the little things are the hardest
    I know what u mean... Ur welcome

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles