Jump to content

PHP and HTML Help


lpxxfaintxx

Recommended Posts

[code]<?php
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
$imageid= $_GET["id"];
$result = mysql_query("SELECT * FROM files WHERE id=$imageid");
$myrow = mysql_fetch_array($result);
?>
<html><center>
<img src="<?php echo $myrow["idpath"]; ?>"/></center>
<br /><center>
<table width="551" height="54" border="1">
  <tr>
    <td><?php echo $myrow["description"];?></td>
    </center>Description:
  </tr>
</table></center>
<a href="nfndf">dndnf</a><br />
<br />
<center>
  <p>&nbsp;</p>
  <p>Share With Your Friends!</p>
</center>
HTML: <input type="text" name="thetext" size="80" value="<a href="http://starcraftarena.roxr.com/fusion/"><img src="<?php echo $myrow["idpath"]; ?></a>"><Br />
BBCODE: <input type="text" name="thetext" size="80" value="[url=http://starcraftarena.roxr.com/fusion/][img]<?php echo $myrow["idpath"]; ?>[/img][/url]"><br />
AIM Profile:
<input name="thetext" type="text" value="<a href="http://starcraftarena.roxr.com/fusion/viewimage.php?id=<?php echo $myrow["id"]?>">HELLO</a>" size="80" />
<Br />
</html>
<?php
require_once "side_right.php";
require_once "footer.php";
?>[/code]

Before I even tried testing the script, I know its not gonna work.

[code]AIM Profile:
<input name="thetext" type="text" value="<a href="http://starcraftarena.roxr.com/fusion/viewimage.php?id=<?php echo $myrow["id"]?>">HELLO</a>" size="80" />[/code]

There are 2 quotes ( " ) so it obviously wont work. Same with line 25. Is there any way around this?
Link to comment
https://forums.phpfreaks.com/topic/4794-php-and-html-help/
Share on other sites

Thats not the problem. I am trying to make a "imageshack" clone, where after you upload the file the html code or bbcode appears.

The bbcode comes out fine, but the ones with 2 quotes come out like this: [a href=\"http://starcraftarena.roxr.com/fusion/viewimage.php?id=30\" target=\"_blank\"]http://starcraftarena.roxr.com/fusion/viewimage.php?id=30[/a]
Link to comment
https://forums.phpfreaks.com/topic/4794-php-and-html-help/#findComment-16863
Share on other sites

Try changing

[code]<input name="thetext" type="text" value="<a href="http://starcraftarena.roxr.com/fusion/viewimage.php?id=<?php echo $myrow["id"]?>">HELLO</a>" size="80" />[/code]

to

[code]<input name="thetext" type="text" value="<a href="http://starcraftarena.roxr.com/fusion/viewimage.php?id=<?php echo $myrow["id"]; ?>">HELLO</a>" size="80" />[/code]

and see what happens.
Link to comment
https://forums.phpfreaks.com/topic/4794-php-and-html-help/#findComment-16868
Share on other sites

Use single quotes:
[!--html--][div class=\'htmltop\']HTML[/div][div class=\'htmlmain\'][!--html1--]<[color=blue]input name[/color]="[color=orange]thetext[/color]" type="[color=orange]text[/color]" size="[color=orange]80[/color]" value='[color=orange]<[span style=\'color:blue\']a href[/color]="http://starcraftarena.roxr.com/fusion/viewimage.php?id=<?php echo $myrow["id"]; ?>[/span]">HELLO<[color=blue]/a[/color]>'/>[!--html2--][/div][!--html3--]
Link to comment
https://forums.phpfreaks.com/topic/4794-php-and-html-help/#findComment-16876
Share on other sites

Ahhh PHP and quotes - they play so nice together

General Rules Of Thumb

In PHP:

When echoing you should always try to use echo " " The dbl quotes allow for variable evaluation inside the echo whereas echo ' ' would return a literal echo.

If your echo requires the echoing of a dbl quote you MUST precced it with a '\' deliminator.

When echoing an array element outside of an echo use single quotes $my_array['element']

When echoing an array element inside an echo you don't want ANY quotes echo "$my_array[element]"

If your array is keyed with an int Vs. text then you NEVER use quotes of any type.

Link to comment
https://forums.phpfreaks.com/topic/4794-php-and-html-help/#findComment-16897
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.