Jump to content

php issue with special characters


rileypool

Recommended Posts

Here's the script I'm using.  For some reason the html code inside the <input> tag always stop after the $value variable.  Can anybody explain to me why this happening and how I can properly address this problem?

 

<?php
$file = fopen("http://get-commented.topmsrs.com/test/urls.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached

$siteURL = "http://get-commented.topmsrs.com";
$siteDescription = "get-COMMENTED!  For all your MySpace Commenting needs!";
$imgURL = array();
$i = 0;
$int = 0;

while(!feof($file)) {
$imgURL[$i] = fgets($file);
$i++;
}
fclose($file);

echo '<center>';
foreach ($imgURL as $value) {
echo '<img src="'.$value.'"><br />';
echo 'Copy & Paste the Code Below to your Profile or Comment Box<br />';
echo '<input type="text" name="Avatar '.$int.'" class="" onclick="" value="<center><a href="'.$siteURL.'"><img src="'.$value.'"><br />'.$siteDescription.'</a></center>"><br /><br />';
$int++;
}
echo '</center>';
?>

Link to comment
Share on other sites

<? echo '<input type="text" name="Avatar '.$int.'" ?>

 

iN THE PORTION OF CODE ABOVE WOULD THE \ BEFORE THE " CARACTER COME INTO PLAY? i KNOW WHEN YOU USE ECHO"SOMETHING "; IF THERE WERE A " CHARACTER THERE YOU WOULD HAVE TO ADD \  BEFORE IT SO THAT PHP WILL RECOGNIZE IT. bUT I DONT KNOW ABOUT THIS CASE.........  echo 'SOMETHING' I havent ever tried lol NOT MY THING.

Link to comment
Share on other sites

  <?php
echo "<img src=\"$value\"><br />";
echo "Copy & Paste the Code Below to your Profile or Comment Box<br />";
echo '<input type=\"text\" name=\"Avatar $int\" class=\"\" onclick=\"\" value="<a href=\"$siteURL\"><center><img src=\"$value" alt=\"$siteDescription\"></center><br /><br />';
$int++;

?>

 

 

Hey try this........ Dont be scared to test this stuff useing the html tags... I know I know there is a standard but ehe

Link to comment
Share on other sites

<?php

foreach ($imgURL as $value) {
echo '<img src=\"".$value."\"><br />';
echo 'Copy & Paste the Code Below to your Profile or Comment Box<br />';
echo '<input type=\"text\" name=\"Avatar ".$int."\" class=\"\" onclick=\"\" value=\"<center><a href=\"".$siteURL."\"><img src=\"".$value."\"></a><br />".$siteDescription."<center><br /><br />";
$int++;
}
echo '</center>';

?>

 

Try this I changed it a lil.

Link to comment
Share on other sites

Thanks again to everybody for their help but I changed my code to this and it worked like a charm.  Plus its quite a bit simpler and easier to read!

 

echo '<textarea name="Avatar '.$int.'" cols="80" rows="3"><center><a href="'.$siteURL.'"><img src="'.$value.'"><br />'.$siteDescription.'</a></center></textarea><br /><br />';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.