CodeIgniter Forums
form helper form_open() oddness - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: form helper form_open() oddness (/showthread.php?tid=65855)



form helper form_open() oddness - dbrooke - 08-01-2016

Hello, I'm a newb.. going through the tutorial.

V. 3.0.6

I believe I've followed the tutorial correctly (copy / paste), but I'm getting a weird action with:

Code:
<?php echo form_open('news/create'); ?>



When I look at the source it shows:
Code:
<form action="<mydomain>/CI306/index.php/news/create" method="post" accept-charset="utf-8">

It does not list the protocol in the URI (http://), so my browser (firefox) treats it like an extension of the query string.. thus producing a URL of:

Code:
<mydomain>/CI306/index.php/<mydomain>/CI306/index.php/news/create

The docs show I am using form_open() correctly:
https://www.codeigniter.com/userguide3/helpers/form_helper.html#available-functions

Quote:Here’s a simple example:
echo form_open('email/send');

The above example would create a form that points to your base URL plus the “email/send” URI segments, like this:
<form method="post" accept-charset="utf-8" action="http://example.com/i

Any advice appreciated.  I can force the correct URL by adding the entire query string with the protocol, but that sure seems clunky.

Thx,
Donovan


RE: form helper form_open() oddness - InsiteFX - 08-02-2016

Did you set your ./application/config/config.php base_url[] ?


RE: form helper form_open() oddness - dbrooke - 08-02-2016

(08-02-2016, 03:06 AM)InsiteFX Wrote: Did you set your ./application/config/config.php base_url[] ?

Hi, thx for the reply. Yes. I was missing the protocol in the base URL. Adding it fixed the main issue.

Donovan