Jump to content

sending varibles


marquis

Recommended Posts

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...