passing variables, if($submit)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Patriot
Forum Commoner
Posts: 34
Joined: Tue Jun 18, 2002 1:36 pm

passing variables, if($submit)

Post by Patriot »

can someone help me with this? i did read the sticky, but i still dont get it.

mysql_pconnect("localhost", "user", "pass");
mysql_select_db("news"); if(.$_GET['submit']);

is there something obviously wrong with this?
i cant get it to work.

sorry if this is against the rules, but i just couldnt understand the Sticky note. :(
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if(.$_GET['submit']);

Code: Select all

if($_GETї'submit']);
a dot too much
Patriot
Forum Commoner
Posts: 34
Joined: Tue Jun 18, 2002 1:36 pm

Post by Patriot »

i keep getting this:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\apache\htdocs\news\add_news.php on line 3


and the third line is:
mysql_select_db("news"); if("$_GET['submit']");
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

ok, first of all you're logic is wrong .. second of all, it's:

if ($_GET['submit']) and NOT if ("$_GET['submit']")
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if($_GET['submit']);
nothing will be done, neither if $_GET['submit'] evaluates to TRUE nor if to FALSE.
FALSE: if-condition fails (of course ;) )
TRUE: ; is excecuted (that is valid but useless - you would get a warning from c-compilers)

what do you want to achieve?
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

It can't be just

Code: Select all

if("$_GETї'submit']");
it's got to be like

Code: Select all

if($_GETї'submit']) { ACTION }
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

not really

Code: Select all

if(TRUE):
//actions
endif;

if(TRUE) //action;

if(TRUE){
//action
}
...all those should work
Post Reply