With Codeigniter, you can use form helpers and validation for forms. However, in some circumstances, you may have forms from other PHP applications and do not want to translate everything into the CodeIgniter classes. This is where some creativity is needed with regard to the controller and view files; especially since running on WAMP or a live site is two different tweaks. With WAMP, you will need to connect to the database and can easily set an include path for the connection. The path could be something like:
<?php include(‘http://localhost/mysite/cgi/connect.php’); ?>
With a live site site it may be something like:
<?php include(‘connect.php’); ?> WHERE connect.php is in the include folder which is specified in the php.ini file or .htaccess file.
Apart from that, on WAMP, you can use the file path to call the file to validate the form, etc. The path could be something like:
<form method=”post” action=”../cgi/myvalidation.php”>
With a live site, the procedure would be to call a controller. Of course, calling the controller requires no need to use the .php file extension. The code could be something like:
<form method=”post” action=”../index.php/myvalidation”> WHERE myvalidation is a controller that loads view files which connect to the database.
The file which is calling the php controller file needs to connect to the database. Any other include files need to be included too, if necessary.
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton