Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What am I doing wrong - If / Else 2

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
The following code is failing, saying I have an unexpected {

In the code I am trying to action the return of a posting, If its 'cancel' then I need to either make all session variable null, or destroy them. At the moment its destroying me!

Many thanks
 
Yoik, thanks.

if($_POST['cancel']
{
//do your session unsetting - Clear variable values or destroy
}
else // assume accept was pressed

{
// Put in variables
$_SESSION['DB6'] = $_POST['DB6'];

}


Many thanks
 
You're missing the closing "[red])[/red]" here:
Code:
if($_POST['cancel'][b][red])[/red][/b]
 {
Ken
 
Code:
if($_POST['cancel'][red][b])[/b][/red]
 {
   //do your session unsetting - Clear variable values or destroy
 }
 else // assume accept was pressed

 {
    // Put in variables
$_SESSION['DB6'] = $_POST['DB6'];

 }
Missing closing parenthesis. You could spot these mistakes yourself.
 
Many thanks Ken, have a star for spotting that one. I'm on my way again!!
 
Here that whistle, that's a penalty flag for piling on.

[spineyes]

Thanks,
--Mark
 
Actually, no penalty... We all posted at the same time. I just hit submit first.

Ken
 
OK we'll pick up the flag this time....

It wasn't a complaint or sarcasm, just a small-- bit of humor...

I know exactly how it is, you start the post, answer the phone, work on the post, talk to the boss, work on the post.

What's really silly is my spelling of "hear".

Thanks,
--Mark
 
Blimey, everyone is buzzing around. Thanks sleipnir, a star for you, but not for Vragabond, you left it out in the first place - sneaky.

Regards
 
ZOR:

ZOR said:
you left it out in the first place - sneaky
This forum does not exist to provide code. This forum exists so that PHP programmers may pool and share knowledge.

Any code posted here can be assumed to exist for the purposes of demonstrating a concept and must not, REPEAT NOT, unless otherwise specified, be considered production code.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Point understood, what code I see appearing is basic structure, concept, nothing more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top