This is a discussion on "IF value entered is nothing?" within the PHP Forum section. This forum, and the thread "IF value entered is nothing? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
IF value entered is nothing?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
IF value entered is nothing?
I forgot how to do this and I can't find anything in google.
I need a quick if to search if $gamertag has anything entered, if it doesn't i need it display an error message otherwise display the below. Thanks.
|
|
|
|
#2
|
|||
|
|||
|
Re: IF value entered is nothing?
if (isset($gamertag))
or if ($gamertag) or if (trim($gamertag)) or if(trim($gamertag) != "") should all return true if $gamertag is set. (I think...) |
|
#3
|
|||
|
|||
|
Re: IF value entered is nothing?
Thanks.
|
|
#4
|
|||
|
|||
|
Re: IF value entered is nothing?
|
|
#5
|
|||
|
|||
|
Re: IF value entered is nothing?
What's with the echo's all over the place?!
|
|
#6
|
|||
|
|||
|
Re: IF value entered is nothing?
Yeah actually, I won't need them now
Can you spot my problem though? I'll clean the echos up before i update the site with the working if |
|
#7
|
|||
|
|||
|
Re: IF value entered is nothing?
There's an else { } too many ... at the bottom?! and a few things wrong.
Here's what I got when removing the echo's
What's this? }; } |
|
#8
|
|||
|
|||
|
Re: IF value entered is nothing?
That's ending;
|
|
#9
|
|||
|
|||
|
Re: IF value entered is nothing?
Ah ... like this then
|
|
#10
|
|||
|
|||
|
Re: IF value entered is nothing?
Looks much cleaner(Thanks) and I doubt you know but you also fixed another problem i had, it would randomly display a '1' after the image
Any idea as to why the isset is not working? |
|
#11
|
|||
|
|||
|
Re: IF value entered is nothing?
Has $gamertag been given a value before this script? How do they get to this point?
|
|
#12
|
|||
|
|||
|
Re: IF value entered is nothing?
http://www.360sigs.com/gamercards.php
They get it from entering there tag, enter my tag 'PicoDeath and at the top it will display 'Thank you PicoDeath', enter no tag and it KNOWS nothing is in the form because it displays 'Thank you No username here for using...' |
|
#13
|
|||
|
|||
|
Re: IF value entered is nothing?
|
|
#14
|
|||
|
|||
|
Re: IF value entered is nothing?
Put that in just now, it displays 'Enter a gamertag' yet you entered one and it displays it at the top. And if you don't enter one it displays the code i want it too.
I guess i just switch the contents of the IF around for it to work? Fixed thanks. Last edited by PicoDeath; Aug 2nd, 2007 at 16:34. |
|
#15
|
|||
|
|||
|
Re: IF value entered is nothing?
Opps ... right...hehe ... yes
I guess it would something like this
|
|
#16
|
|||
|
|||
|
Re: IF value entered is nothing?
Haha, I asked because you were replying so fast in the end i just tried it and it worked.
|
|
#17
|
|||
|
|||
|
Re: IF value entered is nothing?
Phew! 'cause if you would've told it didn't work ... I was gonna pack up my $hit and leave!
Glad to we got that working |