i have a form using the GET method and i'm currently redirected to this url
www.mysite.com/index.php?token=123&cl=page&searchparam=mysearchtext
And i want to trick the get method via htaccess to rewrite the url to this
www.mysite.com/index.php?token=123&cl=page&searchparam=anothertext
How can i do it without the header(location).
Related
In codeigniter website i have url like this www.mywebsitename.com/used-motorbikes, In that page there is form to search location when user select location EX: location1 then the url should change to something like this
www.mywebsitename.com/used-motorbikes-location1 is it possible to add like this?
Add logic in client side js to form this URL first. Then redirect window location to this.
In codeigniter make sure you have route added for www.mywebsitename.com/used-motorbikes-* and handle it to give needed response.
$route['used-motorbikes-(:any)']
I'm trying to get domain.com/employee?display_county=sd&dept=sales&id=23 to display in the URL as domain.com/firstnamelastname while retaining the URL variables.
And also if someone goes directly to domain.com/firstnamelastname it would still have the original URL variables.
How would one accomplish this?
Edit: OK, so I'm starting to rethink this...
Let's say I have a page that displays a list of users.
Each user has a clickable link that directs to domain.com/employee?display_county=XX&dept=XXXXX&id=XX
How could I get the URL to display domain.com/firstnamelastname when a user is clicked and still bring up the correct user?
I was thinking maybe using a POST method to pass the id to the script that displays the user and then rewriting the URL to display the firstnamelastname related to the id, but then browsing directly to domain.com/firstnamelastname would leave the id variable empty...
I am using CakePHP project in IFrame. I have a query string bid in the URL.(Eg: http://localhost:8765/?bid=Mjc). Initially I use $_GET['bid']. Later I have used $this->request->query['bid'].
The last method I used is working fine when I call the URL directly into the browser. But when I call the URL from IFrame(Eg: <iframe src='http://localhost:8765/?bid=Mjc' id='WidgetFrame'>), the $this->request->query array comes empty.
Could any one please suggest me best method to get bid from URL.
NOTE: Using $_GET['bid'] working on both Browser and IFrame.
Thanks.
I've run into an issue validating my form as my View (the page where the form is) is loaded with a query string.
My view URL looks like: http://mydomain.com/insert/new?image=http://www.image.com/image.jpg
For this view to work, I need the query string as it looks up the image URL and performs an action on my page.
When I submit a form on this page that wasn't validated (validation works fine), instead of using $this->load->view('insert_new'); (where insert_new is my view page with the URL above), I construct a URL dynamically with the query strings and use the header('Location:' . $view); function. The view file has echo form_errors(); in it but, I don't see any errors. Is this because of the constructed URL and query string? To also confirm, my controller functions to view the page and handle the form are different. How do I get this to work? Thanks.
If I understand correctly your flow is as follows:
System loads form page with GET url data (image)
User submits form
System validates form and redirects to to $view using a HTTP redirect
The problem is, that by redirecting the POSTed form data is lost, because the browser sends another GET-Request to the constructed URL - and does not re-submit the data!
So if you want to show any form errors you must do that in the same request as the validation, ie by loading a view after the validation instead of redirecting.
I want to call another action in cakephp . I want to run all the code in the action and render the view of that action. I know this can be done using $this->requestAction(), but the problem here is that it is not setting my title for the page which im doing in the called action. And i don't want to use redirect because it changes the url in my browser(ie it sends http 302).
From inside any action, you can manually render any view using $this->render (see api docs). Of course, you'll have to set the variables required on the other view beforehand.