Welcome Guest, Not a member yet? Register   Sign In
how to pass variiables from view to controller ??
#2

[eluser]tonanbarbarian[/eluser]
Your issue here is purely syntax
change
<code>echo site_url('jbcontroller/showjob/$x');</code>
to
<code>echo site_url('jbcontroller/showjob/'.$x);</code>

would also work if you change the single quotes to double quotes.
PHP does not evaluate variables in a string if the string is defined with single quotes, only if the string uses double quotes

Historically PHP has always been recommended to use single quotes rather than double quotes because if you use double quotes PHP has to parse the string to see if there are any variables to evaluate. This may have changed in some of the later 5 or newer 6 versions of PHP but it is always safer to use single quotes than double just to be sure.
However as indicated if you use single quotes you must break out of the string and concatenate your variable into the string rather than include it in the string.
On most sites the speed improvement may not be noticable to a user, but on a size with huge load of users it could mean the difference between a successful page and a server crash.


Messages In This Thread
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 10:24 PM
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 10:35 PM
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 10:54 PM
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 11:04 PM
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 11:17 PM
how to pass variiables from view to controller ?? - by El Forum - 06-21-2009, 11:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB