Welcome Guest, Not a member yet? Register   Sign In
[share]a simple way to check whether a forum has been submit
#1

[eluser]basementDUDE[/eluser]
I am such a noob, I always find isset() and empty() confuseing.

I use this trick.

lets say you have a forum to ask people to submit email address, and you post data to itself.

you can just do this:
Code:
$email = $this->input->post('email', TRUE);

if($email === false)//you have to use triple === otherwise it won't work
{
//forum has not been submit yet
}
else
{
//forum has been submit
}

you don't need any function such as isset(), empty() or place hidden input field as flag in html.
#2

[eluser]Prensil Technologies Pvt Ltd.[/eluser]
This might work but the `===` operator will make the string comparison and thus it will be costly in terms of performance. We should use if($email) for better check the condition. If condition will work best in this scenario.




Theme © iAndrew 2016 - Forum software by © MyBB