I am new to PHP / javascript and cant figure out how to put this code: onMouseOver="javascript:change('<b>CHANNEL DESCRIPTION:</b> <?php echo ucfirst($name);?> - <?php echo addslashes($short_details); ?>')" onMouseOut="javascript:change('<?php echo $descch; ?>')" Code (markup): inside <?php echo '<a href=channel.php?channelId='.$chname_f['channelId'].'&catId='.$chname_f['catId'].' HERE target=iframe><strong>'.ucfirst($chname_f['name']).'</strong></a>'; ?> Code (markup): thank you all for your help & time !
<body> ... <a href="channel.php?channelId=<?=$chname_f['channelId']?>&catId=<?=$chname_f['catId']?>" onMouseOver="javascript:change('<b>CHANNEL DESCRIPTION:</b> <?=ucfirst($name)?> - <?=addslashes($short_details)?>')" onMouseOut="javascript:change('<?=$descch?>')" target=iframe> <strong><?=ucfirst($chname_f['name'])?></strong> </a> PHP: in php you can use shorthand tags like: <?=$foo?> is the same as <?PHP echo $foo; ?> careful as they may be disabled by php.ini (very unlikely). also, there is NO need for you to constantly end a string and concatenate it with a variable and continue it, its ineffective and annoying. use double quotes - " and it supports evaluating variables. stick arrays in { } // this will work also, not done the onmouseout. echo "<a href='channel.php?channelId={$chname_f['channelId']}&catId={$chname_f['catId']} onMouseOver=\"javascript:change('<b>CHANNEL DESCRIPTION:</b> " . ucfirst($name) . " - " . addslashes($short_details) . ");\" target=iframe><strong>" . ucfirst($chname_f['name']). '</strong></a>'; PHP: this really should be in the php forum not js. also, this is awful js, you should never use inline js but thats another matter and clearly not one you are ready for yet
I don't code PHP but have a look here: http://au.php.net/echo The syntax: echo <<<END This uses the "here document" syntax to output multiple lines with $variable interpolation. Note that the here document terminator must appear on a line with just a semicolon. no extra whitespace! END; Code (markup): looks like it could be of use here.
cam: this will not be effective because whereas you can use $variables within a block, you cannot call a function like ucfirst() w/o ending the block first. of course, he can do $varname = ucfirst($varname); and then reference $varname ... still, this is not a JS issue, the ghost mods need to pick this up and move it