Welcome Guest, Not a member yet? Register   Sign In
Procession Form data outside CI framework.
#1

[eluser]Unknown[/eluser]
Hi I am a newbie to CI, actually I inherited it from a client. The previous programmer left so I was force to start learning it and actually liking it. I have a problem where a contact form was setup in the controllers, not in view etc. I was wondering is there a way to process the form data outside the CI framework. can I just direct <form id="contact-form" action="send_email.php" method="POST"> I tried that but it does not do anything.

Any help will be great appreciated.

Cheers
#2

[eluser]jedd[/eluser]
Hi RedwineShiraz and welcome to the CI forums.

[quote author="RedwineShiraz" date="1260065822"]
... learning it and actually liking it.
[/quote]

This is a common reaction - don't fight it Smile


With your form - you should just be able to change the action to point somewhere else, and do what you like with it. What are you trying to achieve / avoid by doing this?

You might have to absolute-path the action= bit, of course, to take it exactly where you have your receiving page.
#3

[eluser]Unknown[/eluser]
Hi Jedd thanks for your response. I haven't tried the absolute path. I will give it a try and see what comes out of it. What I am trying to accomplish is using the form created by the previous programmer. He created this form inside a varible in the index function of the contact form controller. Example:

class Contact extends Controller {
function index()
{
$this->load->helper('url');
$content = <<<EOD

&lt;form id="contact-form" action="send_email.php" method="POST"&gt;

[html form code here]

&lt;/form&gt;
}

$this->load->view('template', array("pageTitle" => "Contact Us", "pageContent" => $content,"pageSel" =>contact" ) );
}}

As you can see my modification was to add the action="send_email.php" method="POST" hoping that should work with like I would with a regular site without the CI framework. But that didn't work. I tried placing send_email.php in the application folder but that did not work. I will try the absolute path.

In the long run I can see the work put into building a site with a CI framework can be modular and easy to maintain down the road. Of course, done according to how the framework was intended to be used.

PS: I tried the absolute path that will not work when RewriteRule ^(.*)$ /index.php/$1 [L] is on. When that is removed it works. Is there a way to have the RewriteRule turn on and still have the absolute path work?
#4

[eluser]jedd[/eluser]
[quote author="RedwineShiraz" date="1260169542"]
PS: I tried the absolute path that will not work when RewriteRule ^(.*)$ /index.php/$1 [L] is on. When that is removed it works. Is there a way to have the RewriteRule turn on and still have the absolute path work?
[/quote]

If the absolute path that you are heading towards is within your CI application, then this will fail - unless you modify your .htaccess file to allow it.

But that doesn't make sense, because you said this is a page that is outside of your CI application. If it's within your CI application, then you don't want to absolute path it - as presumably something within CI is meant to handle it.
#5

[eluser]charlie spider[/eluser]
If it is within your CI framework then send_email.php would have to be within your application/controllers folder not just your application folder. You may already know this and just wrote your response that way to save time, but being a newbie you may have missed that, so sorry for pointing out the obvious if you already knew this.

can you show your entire absolute path ???




Theme © iAndrew 2016 - Forum software by © MyBB