surreal5335 Posted April 23, 2010 Share Posted April 23, 2010 I have a comment board that is nearly completed although right now when you submit a new comment, the form action is done right but stays on the new page without calling the create_post() I created. The function does work, I have seen it work recently but while trying to get a page redirect from the called page back to the main page with all posts I was not able to get create_post() working again (I have not made any changes to create_post() ). Here is the code for the form and where the action takes you to: <form action = "<?php echo DS.APP_ROOT.DS;?>views/posts/create.php" method="post"> <?php include('_form.php'); ?> </form> Here is the code for the page the form takes the user to (I expect this not to do anything valuable): <?php print_r($params); ?> This is the controller end that is suppose to call create_post() and hopefully execute the redirect back to the main page (this is my problem child): switch($route['view']) { case "create": if(create_post($params['post'])) { flash_notice('Successfully created post!'); redirect_to('posts'); } header( 'Location: http://www.royalvillicus.com/comment_board/' ) ; break; } This all worked at one point w/out the redirect. While trying to get the redirect to work, this stopped getting called. I did put an HTML redirect into my create.php file (the one with the print_r() ), the redirect worked but nothing got submitted to the database. I am an array for the url routes in my config file. The one that helps determine which case: to execute in my controller. Here is the code for my 'create' url route. 'url' => '/^posts\/create$/', 'controller' => 'posts', 'view' => 'create'), To see what I am talking about, here is my site url: http://royalvillicus.com/comment_board/ Thanks a lot for the help Link to comment https://forums.phpfreaks.com/topic/199458-unable-to-fire-create_post-from-my-mvc-setup/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.