Welcome Guest, Not a member yet? Register   Sign In
Short tag does not work...??

Hi, I am new to PHP and currently facing issues while working on my 1st PHP app.

The issue is :

<?php= form_open('expense/fix_insert');?>

would not work on my PHP view file and would not get translated to
<form method = "post" action = "http://localhost/ci/index.php/expense/fix_insert">
in the source code on the browser. I am using codeignite framework for my application and have loaded form helper in controller already.

Moreover, <?=$expenditure?> type of tag also does not work .. only when I use echo then it works..

in php.ini I have made below change:
short_open_tag = On [Portability]

please suggest.

Many Thanks,

have you restart your web server after making changes in php.ini file if not than restart it , it will work.

If you're using CodeIgniter, you don't need short tags on in order to use the alternative syntax. Read the user guide for more info... http://ellislab.com/codeigniter/user-gui...e_php.html

As for your first issue... what does the form action link to if not http://localhost/ci/index.php/expense/fix_insert?

Have you specified your base URL in the config file per CI's installation instructions?

My first suggestion would be to just not use short tags. It's a bad habit to get into since it binds any code that uses it to an environment which has short tags enabled. As far as the option to have CI process short tags even when the PHP configuration does not have it enabled, that comes at the expense of all such code be eval()'d, which will add additional processing overload and likely make debugging a bit more difficult due to any applicable errors showing up as eval() errors. Therefore my preference, at least, is to just type a few more characters and never have to worry about it again. Smile

[quote author="NogDog" date="1240230379"]Therefore my preference, at least, is to just type a few more characters and never have to worry about it again. Smile[/quote]

Or, you could just make your IDE expand short tags to long tags

Although I personally prefer the synrax of short tags for echo's but stick to long tags for opening classes etc

thanks guys for replies... My issue is resolved.

Theme © iAndrew 2016 - Forum software by © MyBB