CodeIgniter Forums
forms have no input boxes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: forms have no input boxes (/showthread.php?tid=53000)



forms have no input boxes - El Forum - 07-06-2012

[eluser]wesleychristelis[/eluser]
i have the following basic piece of code

<?= form_open()?>
<?=form_open()?>

<?=isset($message) ? $message : ''?>

<p>
Username: &lt;?=form_input('username', set_value('username'))?&gt;
</p>
<p>
Password: &lt;?=form_password('password')?&gt;
</p>
&lt;?=form_submit('submit', 'Login')?&gt;
&lt;?=form_close()?&gt;

when viewing it in the browser i only see the following (see screen shot ) I have no input boxes... not sure what is wrong .

the titles i.e. username ad password show . but the input boxes next to them dont , i have tried firefox , chrome, safari... no luck .

what am i missing

CI 2.1.2



forms have no input boxes - El Forum - 07-06-2012

[eluser]InsiteFX[/eluser]
You do not have php short tags turned on:
Code:
&lt;?=
// change all php tags to
&lt;?php echo form_open(); ?&gt;



forms have no input boxes - El Forum - 07-09-2012

[eluser]wesleychristelis[/eluser]
hi apologies

&lt;?php form_open()?&gt;

&lt;?php isset($message) ? $message : ''?&gt;

<p>
Username: &lt;?php form_input('username', set_value('username'))?&gt;
</p>
<p>
Password: &lt;?php form_password('password')?&gt;
</p>
&lt;?php form_submit('submit', 'Login')?&gt;
&lt;?php form_close()?&gt;

for the above it was omitting the "echo" ...see below ... fixed this .

&lt;?php echo form_open()?&gt;

&lt;?php isset($message) ? $message : ''?&gt;

<p>
Username: &lt;?php echo form_input('username', set_value('username'))?&gt;
</p>
<p>
Password: &lt;?php echo form_password('password')?&gt;
</p>
&lt;?php echo form_submit('submit', 'Login')?&gt;
&lt;?php echo form_close()?&gt;



forms have no input boxes - El Forum - 07-09-2012

[eluser]TWP Marketing[/eluser]
First, please enclose your code in the [ code][ /code] tags so we can read your code easier.

Next, your php statements do not appear to have the closing semicolon (Wink which may or may not be the problem. I have inserted them in the snippet below.

Code:
&lt;?php echo form_open(); ?&gt;

&lt;?php isset($message) ? $message : ‘’; ?&gt;


  Username: &lt;?php echo form_input(‘username’, set_value(‘username’)); ?&gt;


  Password: &lt;?php echo form_password(‘password’); ?&gt;

&lt;?php echo form_submit(‘submit’, ‘Login’); ?&gt;
&lt;?php echo form_close(); ?&gt;



forms have no input boxes - El Forum - 07-09-2012

[eluser]CroNiX[/eluser]
Did you load the form helper?


forms have no input boxes - El Forum - 07-09-2012

[eluser]CroNiX[/eluser]
@TWP Marketing - technically you only need semicolons to separate multiple statements within a single php code block, although it's generally a best-practice to use them at the end of each statement. Never worked for a professional firm where that was acceptable.


forms have no input boxes - El Forum - 07-09-2012

[eluser]TWP Marketing[/eluser]
@CroNiX, Thanks for the tip. I never leave them out, so it has never come up before.