How to solve this form action problem in code igniter? - codeigniter-3

CodeIgniter form action causes problem.
When I write below action URL without index.php it runs fine on Chrome and not on firefox
<form method="POST" action="Login/Loginme">
But When I write below action URL with index.php it does not run on chrome and run on firefox.
<form method="POST" action="index.php/Login/Loginme">

use site_url();
<form method="POST" action="<?php echo site_url('Login/Loginme'); ?>">

Using base_url() followed by the controller is best practice. eg. base_url('myController/myFunction')

Related

Where is the OpenCart form action url

I am using OpenCart 3.0.2.0. Where is the form action path in OpenCart Twig file?
Here is some of the code:
<form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-product" class="form-horizontal">
I don't know where this action comes from.
You can go to the admin directory
Path :
admin\controller\catalog\product.php
and find
$data['action']
you can see it for action in view files as well.

Codeigniter 4 form action path

sorry for the very noob question. I have a page : www.example.com/edit/3 with form inside.
<form class="" action="" method="post">
Usually my form action I will specify something like add, register, etc. In this case, I am not sure how do I specify it. Currently it is working when I save it if I leave it blank without specifying anything. But I am not sure is this the right way to do it.
Controller
public function edit_game(){}
Routes
$routes->match(['get', 'post'], 'account/edit_game/(:num)', 'Addgame::edit_game/$1');
Can anyone advise?
action="" is the URI to which send the form data, aka the controller where you treat the received data. If not specified, it will be the same page as the one you are currently on.
What you can do:
<form method="post">
</form>
<form method="post" action=""> <!-- same as previous -->
</form>
<form method="post" action="/some/page">
</form>
In the last example, note the leading /, it means it is according to the site root. If you forget it, it will be relative to the current URI.
Exemple, if the page containing the <form> is http://example.com/edit/3:
action="/some/page" will redirect to http://example.com/some/page.
action="some/page" will redirect to http://example.com/edit/some/page

WordPress : Redirect a form validation & submit

What would be the best way to redirect a form after validation & submit? The form isn't a plugin, it's part of a theme.
a) This is the form action code:
<form action="" id="pro_form" enctype="multipart/form-data" method="post">
b) Here's the validation string:
<input type="submit" onclick="return validation()" value="Submit" >
Any help would be appreciated. Thanks!
Peter
I am not sure if this is want you are asking for, but in my opinion the best way is using javascript, like this:
echo '<script type="text/javascript">window.location ="NewLocation";</script>';
Place this code after the form returns from validation.

Magento: How to redirect on form submit

I'm using Magento CE 1.7.
I created a CMS page to add 'Terms Of Use' to it and at the bottom of the page I added a simple "Accept Terms" submit form to have the customers agree to the terms before they can access the page I want them to access. Here's the code.
<form action="url-to-go-to.html" method="GET" onsubmit="return checkCheckBox(this)">
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Continue">
<input type="button" value="Exit" onclick="document.location.href='BACKTOWHAT.html';">
</form>
<script type="text/javascript">
<!--
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert("Please tick the box to continue");
return false;
} else
return true;
}
-->
</script>
The only problem I have is that in I can only get it to work by entering the URL to the page I want them to be redirected to. i.e.
<form action="domainname.com/shop.html"> <!-- store section to go to -->
/* and the same goes for */
onclick="document.location.href='domainname.com';"> <!-- back to storefront -->
I wanted to use something else rather than the URL but I'm not sure how to do it. I thought using something like this would work.
<form action="<?php echo $this->_redirect('shop.html'); ?>" method=.... >
but it didn't.
I believe if this has been within a .phtml file it would've worked but I'm working with a simple CMS page and I know magento functions work in CMS pages but I don't know a function that would work for this purpose.
Ok, I figured it out after testing a bit more. (I'm still learning how to code)
It's quite simple, the form action should be like this instead.
<form action="{{store direct_url='shop.html'}}" method=..... >
and to redirect back to the store front on "exit" this is what worked.
onclick="document.location.href='{{store direct_url=' '}}
This worked perfectly. hope it helps others.

why is wordpress redirecting to home page after form submit?

I am using 'get' method submit the form, but instead of form being submitted to the same page, it redirects to homepage.
<form id="myform" name="myform" action="<?php echo get_permalink( $post->ID ); ?>" method="get">