By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Parse error: parse error, unexpected T_ELSE

P: n/a
I got the following error in my page Parse error: parse error,
unexpected T_ELSE in line 25

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Club</title>
</head>
<style type="text/css">
body {margin : 0px;}
</style>
<body bgcolor="navy">
<font color="white">
Welkom in de winkel. Wat wilt u doen?<br>
<form action="club.php" method="post">
<input type="radio" name="keuzewinkel" value="1">Voer kopen<br>
<input type="radio" name="keuzewinkel" value="2">Bijproducten
kopen<br>
<input type="radio" name="keuzewinkel" value="3">Medicijnen kopen<br>
<input type="radio" name="keuzewinkel" value="4">Praatje maken met de
verkoper<br>
<input type="radio" name="keuzewinkel" value="5">Duiven verkopen /
kopen<br>
&nbsp<br>
<input type="submit" value="Verder">
</form>
<?
if (isset($submit)) {
if ($keuzewinkel == '1') include('koopvoer.php')
else ($keuzewinkel == '2') include('koopbijproducten.php') <--------
line 25
else ($keuzewinkel == '3') include('koopmedicijnen.php')
else ($keuzewinkel == '4') include('chatverkoper.php')
else include('koopduiven.php')
}
?>
</body>
</html>
I tryed to debug it but i cant find it.
Maybe you can help me?
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Marten van Urk wrote:
I got the following error in my page Parse error: parse error,
unexpected T_ELSE in line 25

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Club</title>
</head>
<style type="text/css">
body {margin : 0px;}
</style>
<body bgcolor="navy">
<font color="white">
Welkom in de winkel. Wat wilt u doen?<br>
<form action="club.php" method="post">
<input type="radio" name="keuzewinkel" value="1">Voer kopen<br>
<input type="radio" name="keuzewinkel" value="2">Bijproducten
kopen<br>
<input type="radio" name="keuzewinkel" value="3">Medicijnen kopen<br>
<input type="radio" name="keuzewinkel" value="4">Praatje maken met de
verkoper<br>
<input type="radio" name="keuzewinkel" value="5">Duiven verkopen /
kopen<br>
&nbsp<br>
<input type="submit" value="Verder">
</form>
<?
if (isset($submit)) {
if ($keuzewinkel == '1') include('koopvoer.php')
else ($keuzewinkel == '2') include('koopbijproducten.php') <--------
line 25
else ($keuzewinkel == '3') include('koopmedicijnen.php')
else ($keuzewinkel == '4') include('chatverkoper.php')
else include('koopduiven.php')
}
?>
</body>
</html>
I tryed to debug it but i cant find it.
Maybe you can help me?


Try terminating php lines with ';' when required, and see if that helps?

Groetjes

Steve
Jul 17 '05 #2

P: n/a
Marten van Urk <ur**@nlr.nl> wrote:
I got the following error in my page Parse error: parse error,
unexpected T_ELSE in line 25 .... <?
if (isset($submit)) {
if ($keuzewinkel == '1') include('koopvoer.php')
else ($keuzewinkel == '2') include('koopbijproducten.php') <--------
line 25
else ($keuzewinkel == '3') include('koopmedicijnen.php')
else ($keuzewinkel == '4') include('chatverkoper.php')
else include('koopduiven.php')
}
?> I tryed to debug it but i cant find it.
Maybe you can help me?


This is not how if/else works, please RTFM about control structures:
http://www.php.net/manual/en/languag...-structures.if
and
http://www.php.net/manual/en/control...tures.else.php
and specifically
http://www.php.net/manual/en/control...res.elseif.php

Alternatively http://www.php.net/manual/en/control...res.switch.php
(see example 16-1, that is almost exactly what you are trying to
accomplish).
Jul 17 '05 #3

P: n/a
You are using else statements in an incorrect manner.... you problem
want to use else if in this case... Refer to the links posted by Daniel
Tryba

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.