Page 1 of 1

String help

Posted: Tue Jul 11, 2006 3:10 pm
by Addos
When I mouse over the link on this page the URL parameter returns http://www.mysite.com/\”admin_images_insert.php\” can anyone help me clean up this string?
Below is the little big of code I’m using to produce the link.
Thanks

Code: Select all

"$file_name uploaded successfully." .'<a href="admin_images_insert.php">'. "Upload main image now and details" .' </a>'

Posted: Tue Jul 11, 2006 3:31 pm
by Ollie Saunders

Code: Select all

echo "$file_name uploaded successfully.";
?>
<a href="admin_images_insert.php">Upload main image now and details</a>
<?php
// whatever comes next

Posted: Tue Jul 11, 2006 3:37 pm
by Addos

Code: Select all

$message = ($result)?"$file_name uploaded successfully." .'<a href="admin_images_insert.php">'. "Upload main image and details" .' </a>' : "Something is wrong with uploading a file."; 
  	return $message;
Hi,
This is the entire string.
Thanks
Brian

Posted: Tue Jul 11, 2006 3:47 pm
by Ollie Saunders
That's ugly code man. Don't use ? : for anything other than the smallest statements.
In fact forget it exists altogether.

Code: Select all

if ($result) {
	$message = $file_name . 'uploaded successfully. <a href="admin_images_insert.php">Upload main image and details</a>';
} else {
	$message = 'Something is wrong with uploading a file.';
}
return $message;

Posted: Wed Jul 12, 2006 4:26 pm
by Addos
Hi ya,
Thanks for this help. My only problem is that I still get the “ and \ showing up (see below) when I mouse over the link and I’ve no idea where these are coming from?
Any ideas?
Thanks a mil
Brian

http://www.mysite.com/\”admin_images_insert.php”\

Posted: Thu Jul 13, 2006 12:33 pm
by Ollie Saunders
Well that's because that output isn't coming the code you gave me.
Read about strings and learn how to fix these things yourself or you will forever be coming back here.