marquis Posted January 7, 2007 Share Posted January 7, 2007 iv post this twice in php with no responces so im posting it here to see if yall can help me$accountnum=$row['accountnum'];echo '<center>';echo '<a href="descrip.php?accountnum=$accountnum">';im trying to send a varible through to descrip.php. instead of sending the value of $accountnum is sending the physical sting "$accountnum" im not sure how to fix this Link to comment Share on other sites More sharing options...
magic24688 Posted January 8, 2007 Share Posted January 8, 2007 Not that im a 100% expert at PHP but try to switch the ' and the " like thisecho "<a href='descrip.php?accountnum=$accountnum'>";This might let the $ be called not sure if that fixes but at least I tryed . Link to comment Share on other sites More sharing options...
jesh Posted January 8, 2007 Share Posted January 8, 2007 Try something like this: echo '<a href="descrip.php?accountnum=' . $accountnum . '">'; Link to comment Share on other sites More sharing options...
justsomeguy Posted January 8, 2007 Share Posted January 8, 2007 echo '<a href="descrip.php?accountnum=$accountnum">';The problem is with single-quotes. PHP does not do variable replacement inside single-quoted strings.echo "<a href=\"descrip.php?accountnum=$accountnum\">"; Link to comment Share on other sites More sharing options...
Kristian_C Posted January 9, 2007 Share Posted January 9, 2007 i allways use single when i use variables but i dont have anything more then etc :echo"<a href='?page=forum&forum=main&post=$id'>read</a>";allways thought it was okay to use single why is it like that? should be made more easy (A) Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2007 Share Posted January 9, 2007 That's fine, because the string has double-quotes around it. You have single quotes inside the string, but the string that you are sending to echo is enclosed in double-quotes, so that's why it replaces the variable. You can use single-quotes whenever you want, and it's actually faster if you do, but if you need variable replacement you need to use double-quotes. Link to comment Share on other sites More sharing options...
supertrucker Posted January 12, 2007 Share Posted January 12, 2007 Not that im a 100% expert at PHP but try to switch the ' and the " like thisecho "<a href='descrip.php?accountnum=$accountnum'>";This might let the $ be called not sure if that fixes but at least I tryed .If that doesn't work, you could always to this too:echo "<a href='descrip.php?accountnum=".$accountnum."'>"; Link to comment Share on other sites More sharing options...
Jonas Posted January 14, 2007 Share Posted January 14, 2007 I only found one of your other topics in the php forum (which means it's probably deleted already). Anyway, if you don't get any answers, try to give your existing thread a bump to bring it to people's attention again. I'll merge your two threads this time, since you have replies in both, but next time stick to one thread, okay? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now