0

I am very new to PHP , but i want to show a html page and handle it with and .php file in codeigniter, How can i do it. Example could be like this : http://www.w3schools.com/php/showphp.asp?filename=demo_form_post

I tried to do the same but in controller if i try to run the html file it works fine but as i click on submit and try to fetch values it give my errors.

i do: 1. Made 2 file in view namely: Test.html and Test_Values.php in Test.html i keep : the code as mentioned in w3 link and in Test_Value.php I wrote the logic.

2.In controller i calls : $this->load->view("Test.html"); it shows me my html page but as i click on the submit button it says 404 page not found.

Please help me. What am i doing wrong??

3

1 Answer 1

1

Firstly you will have to put your logic in a function in your controller and not a separate .php file. e.g:

class Yourcontrollername extends CI_Controller{
    ...

    function form_processor(){...}

}

Then You are supposed to give the address and the name of the function which is going to process the form you sumbitted in the action attribute of your form! e.g:

<form action="yourControllerName/form_processor" method="post">

Finally, you really need to have to study the Codeigniter Manual

Sign up to request clarification or add additional context in comments.

4 Comments

Only class name and file name should be first letter upper case. In codeigniter 3
Both doc's of codeigniter here now CI3 and CI2 user guides codeigniter.com/docs
You mean i should give the logic in one function and then refer it in action public function form_Preprocessor{ echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; } I will give a try to .. and let you know soon :) Thankss
instead of <form action="yourControllerName/form_processor" method="post"> <form action="form_processor" method="post"> Worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.