Welcome Guest, Not a member yet? Register   Sign In
How to check 404 URL errors?
#1

[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?
#2

[eluser]TheFuzzy0ne[/eluser]
Check out my [url="http://ellislab.com/forums/viewthread/106556/"]is_working_url()[/url] function (PHP5 only).
#3

[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?
#4

[eluser]TheFuzzy0ne[/eluser]
Please be specific. I don't understand what you mean by "postback check".
#5

[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?
#6

[eluser]pistolPete[/eluser]
You could use the Input class, but there isn't much difference:

Code:
if ($this->input->post('btn_submit'))
{
   // do something
}
else
{
  // do something else
}
#7

[eluser]TheFuzzy0ne[/eluser]
Well in CodeIgniter, you'd achieve the same thing like this:
Code:
if ($this->input->post('btn_submit'))
{
    # Process data
}
else
{
    # Output form
}

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...
#8

[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.
#9

[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.
#10

[eluser]Colin Williams[/eluser]
$this->input->server('REQUEST_METHOD');

Or in plain PHP

$_SERVER['REQUEST_METHOD']




Theme © iAndrew 2016 - Forum software by © MyBB