Page 1 of 1
passing variables, if($submit)
Posted: Fri Aug 23, 2002 7:34 pm
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.

Posted: Fri Aug 23, 2002 7:38 pm
by volka
if(.$_GET['submit']);
a dot too much
Posted: Sat Aug 24, 2002 10:28 am
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']");
Posted: Sat Aug 24, 2002 10:53 am
by protokol
ok, first of all you're logic is wrong .. second of all, it's:
if ($_GET['submit']) and NOT if ("$_GET['submit']")
Posted: Sat Aug 24, 2002 11:20 am
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?
Posted: Sat Aug 24, 2002 2:40 pm
by Takuma
It can't be just
it's got to be like
Code: Select all
if($_GETї'submit']) { ACTION }
Posted: Sat Aug 24, 2002 2:48 pm
by hob_goblin
not really
Code: Select all
if(TRUE):
//actions
endif;
if(TRUE) //action;
if(TRUE){
//action
}
...all those should work