0

Hi, for one of my projects at uni i have to create a PHP based text game, i am basing mine on the colossal cave game.
i am trying to use the explode function to split my string up into variables to check against my database but am getting the error

Parse error: syntax error, unexpected T_STRING in /var/www/game/game.php on line 15

whenever i put the code in, if anyone could help i would be very grateful.

<?php
require('header.html');
?>
<h1>Game</h1>
<p>Click the help button for more Information on playing!</p><br><br>
<div class=inv> <?php require('inventory.php'); ?> </div> <!-- inv -->
<div class="readout"> <?php require('readout.php'); ?> </div> <!-- readout -->
<div class=desc> <?php require('room_desc.php'); ?> </div> <!-- desc -->
<div class=items> <?php require('items_room.php'); ?> </div> <!-- items -->


<?php
$commands = $_REQUEST['commands'];
$comm = EXPLODE(” ”, $commands);
echo “0 = $comm[0]<br />”;
echo “1 = $comm[1]<br />”;
echo “2 = $comm[2]“;
?>
<form>
<div class=commands>
<form method="POST">
<input type="text" name="commands" size="72" value="">  
<input type="submit" name="submit" value="Go!" /></form>
</div> <!--commands -->

<?php require('footer.html'); ?>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by daryll1
0

The quotes that you are using are non-standard.


this wont give you that error:

<?php
require('header.html');
?>
<h1>Game</h1>
<p>Click the help button for more Information on playing!</p><br><br>
<div class=inv> <?php require('inventory.php'); ?> </div> <!-- inv -->
<div class="readout"> <?php require('readout.php'); ?> </div> <!-- readout -->
<div class=desc> <?php require('room_desc.php'); ?> </div> <!-- desc -->
<div class=items> <?php require('items_room.php'); ?> </div> <!-- items -->


<?php
$commands = $_REQUEST['commands'];
$comm = EXPLODE(" ", $commands);
echo "0 = $comm[0]<br />";
echo "1 = $comm[1]<br />";
echo "2 = $comm[2]";
?>
<form>
<div class=commands>
<form method="POST">
<input type="text" name="commands" size="72" value="">  
<input type="submit" name="submit" value="Go!" /></form>
</div> <!--commands -->

<?php require('footer.html'); ?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.