How to check 404 URL errors? |
[eluser]FutureKing[/eluser]
Hi, I am developing a social bookmarking application with codeigniter. When user submits any url I want to check that is that url exists? I mean I want to prevent wrong URL submissions. One more question: I also want to check the request type(i.e. POST or GET or normal) in ASP.net I use if Page.ispostback Is there something similar to it available with PHP or code igniter?
[eluser]TheFuzzy0ne[/eluser]
Check out my [url="http://ellislab.com/forums/viewthread/106556/"]is_working_url()[/url] function (PHP5 only).
[eluser]FutureKing[/eluser]
[quote author="TheFuzzy0ne" date="1237254669"]Check out my [url="http://ellislab.com/forums/viewthread/106556/"]is_working_url()[/url] function (PHP5 only).[/quote] Thank you so much. And what about Postback check?
[eluser]TheFuzzy0ne[/eluser]
Please be specific. I don't understand what you mean by "postback check".
[eluser]FutureKing[/eluser]
[quote author="TheFuzzy0ne" date="1237258054"]Please be specific. I don't understand what you mean by "postback check".[/quote] I mean to check, if the page has been posted back by Submit button of form or not. Currently I am using the following way if(isset($_POST['btn_submit']){ //do processing of input data }else{ //display the form } I want to know that is there any alternative way to check postback?
[eluser]pistolPete[/eluser]
You could use the Input class, but there isn't much difference: Code: if ($this->input->post('btn_submit'))
[eluser]TheFuzzy0ne[/eluser]
Well in CodeIgniter, you'd achieve the same thing like this: Code: if ($this->input->post('btn_submit')) I can't think of any other ways to achieve the same thing, nor can I imagine why you'd want an alternative. Perhaps I am misreading your question? Does that help? EDIT: I think Pete has eaten way too much sugar today...
[eluser]FutureKing[/eluser]
Thank you for your replies. I don't want to use 'btn_submit' or any of form element names to check the post back. I want to check page postback without using any name of form elements.
[eluser]TheFuzzy0ne[/eluser]
I would imagine just checking: count($_POST) > 0 should do the trick. If no form has been posted, the array should be empty.
[eluser]Colin Williams[/eluser]
$this->input->server('REQUEST_METHOD'); Or in plain PHP $_SERVER['REQUEST_METHOD'] |
Welcome Guest, Not a member yet? Register Sign In |