rileypool Posted November 29, 2007 Share Posted November 29, 2007 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 https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/ Share on other sites More sharing options...
trq Posted November 29, 2007 Share Posted November 29, 2007 Does your outputed html validate? Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401798 Share on other sites More sharing options...
rileypool Posted November 29, 2007 Author Share Posted November 29, 2007 I don't think it validates, but here's that script live on the web. Take a look at the HTML code. http://get-commented.topmsrs.com/testing.php Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401809 Share on other sites More sharing options...
dewey_witt Posted November 29, 2007 Share Posted November 29, 2007 <? 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 https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401811 Share on other sites More sharing options...
rileypool Posted November 29, 2007 Author Share Posted November 29, 2007 dewey_witt, I might be wrong but I don't think this applies in my situation. If I take $value out of my code the code displays perfectly. I just hope I can figure this out. Once I figure out this problem I'll be able to make my site go live. Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401817 Share on other sites More sharing options...
dewey_witt Posted November 29, 2007 Share Posted November 29, 2007 <?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 https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401819 Share on other sites More sharing options...
dewey_witt Posted November 29, 2007 Share Posted November 29, 2007 value="<a href=\"$siteURL\"><center> <===opps add a slash after value= like: value=\ Also do the same for img src=\"$value" after $value before the " character Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401821 Share on other sites More sharing options...
~n[EO]n~ Posted November 29, 2007 Share Posted November 29, 2007 I changed this part and it is working for me <?php echo '<input type="text" name="Avatar '.$int.'" class="" onclick="" value="<center><a href="'.$siteURL.'"><img src="{.$value.}"><br />'.$siteDescription.'</a></center>"><br /><br />'; ?> Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401824 Share on other sites More sharing options...
dewey_witt Posted November 29, 2007 Share Posted November 29, 2007 Looks like a good solve to me Neon. I used it and it produced as well. So did my way Either way good fix. lol Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401827 Share on other sites More sharing options...
rileypool Posted November 29, 2007 Author Share Posted November 29, 2007 I'm jealous! I can't get it to work! Thanks for the help so far guys. Check out this link. I beleive I've updated the codes to reflect what you two have suggested. http://get-commented.topmsrs.com/testing.php Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401832 Share on other sites More sharing options...
~n[EO]n~ Posted November 29, 2007 Share Posted November 29, 2007 EDIT : leave it... it only works on the last Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401833 Share on other sites More sharing options...
rileypool Posted November 29, 2007 Author Share Posted November 29, 2007 ~n[EO]n~ I'm not showing that it works on any of them. For me your code only shows {.$value.} when its supposed to be the location of the image. Link to comment https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401835 Share on other sites More sharing options...
dewey_witt Posted November 29, 2007 Share Posted November 29, 2007 <?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 https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401838 Share on other sites More sharing options...
rileypool Posted November 29, 2007 Author Share Posted November 29, 2007 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 https://forums.phpfreaks.com/topic/79366-php-issue-with-special-characters/#findComment-401847 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.