I'm not a PHP genius, so don't laugh I understand how to echo text...but I want to echo some html or javascript code, is this possible? For example... <?php echo $linktwit;?> - this echo's $linktwit and link twit is... <?php $linktwit="<a href="http://www.twitter.com/airwalk_design">airwalk_design</a>"; ?> what is the correct way of doing so?
That isn't the correct way of doing it, because you are using "'s to mark the beginning and end of a string. So it's hard for PHP to interpret when you have "'s within the string. How will it know where your string ends? Instead, use single quotes or backslash the double quotes. Like so: // by backslashing/escaping $linktwit="<a href=\"http://www.twitter.com/airwalk_design\">airwalk_design</a>"; // by using single quotes $linktwit='<a href="http://www.twitter.com/airwalk_design">airwalk_design</a>'; PHP: You could also break out of PHP to output HTML: <?php // your code here ?> HTML here <?php // more code here ?> PHP:
I've actually scrapped this method and found an easier way but I have a new but related question... I have this part in my script... if (T.isConnected()) { currentUser = T.currentUser; screenName = currentUser.data('screen_name'); name = currentUser.data('name'); profileImage = currentUser.data('profile_image_url'); friendCount = currentUser.data('followers_count'); profileImageTag = "<img class='icon' src='" + profileImage + "'/>"; $('#twitter-connect-placeholder').append("<div class='info'><div class='info-in'><form style='width:350px' class='info-in' method='post'><h1>Ask A Question</h1><input value='Type Your Question Here...' type='text' onclick='this.value='';this.onclick=null;'/><br/><input value='" + "<a target=\"_blank\" href=\"http://www.twitter.com/" + screenName + "'>" + name + "</a>" + " type=\"text\"/></form></div></div>"); } else { $("#twitter-connect-placeholder").append("DFKLSJFKLSDJFSLKDJE"); }; }); </script> The > is basically making a nusience of itself because it closes the input of my form rather than a href...and messes up the rest of the input <input value="<a target="_blank" href="http://www.twitter.com/airwalk_design">"Airwalk Design" type="text"/> how can I fix this?
This is a JavaScript/HTML issue - not PHP. Try this: <input value="<a target="_blank" href="http://www.twitter.com/airwalk_design">Airwalk Design</a>" type="text" /> HTML: