Jump to content

Recommended Posts

I cant find the error

 

Unexpected '}' in line 23

 


<?php
IF(isset($_SESSION['id'])){
?>
<h2>Add a User</h2>
<?
IF($_POST['create'] == "Add"){
# Form has been submited

}ELSE{
# form to create a user.
?>
<form action="index.php?mode=adduser" method="POST">
	Username:<br>
	<INPUT type="text" name="name"><br>
	Password:<br>
	<INPUT type="password" name="pass"><br>
	Retype Password:<br>
	<INPUT type="password" name="cpass"><br>
	<INPUT type="submit" name="create" value="Add"><br>
</form>
<?php
};
}ELSE{ # <-- this is the problem line
echo '<p>You must be logged in to see this</p>';
};
?>

 

it is probably really simple, but i have been looking at it for 30 mins and dont have a clue why it is kicking out the error.

 

thanks

~d

Link to comment
https://forums.phpfreaks.com/topic/71165-solved-i-dont-see-the-error/
Share on other sites

I copied your code and it runs fine here. but i did have to remove some bad characters first. don't know if they were from the original code or from posting on the forum. This works fine for me, though I hate semi-colons after if, which, other loops.

 

<?php
IF(isset($_SESSION['id'])){
?>
<h2>Add a User</h2>
<?
IF($_POST['create'] == "Add"){
# Form has been submited

}ELSE{
# form to create a user.
?>
<form action="index.php?mode=adduser" method="POST">
	Username:<br>
	<INPUT type="text" name="name"><br>
	Password:<br>
	<INPUT type="password" name="pass"><br>
	Retype Password:<br>
	<INPUT type="password" name="cpass"><br>
	<INPUT type="submit" name="create" value="Add"><br>
		</form>
<?php
};
}ELSE{ # <-- this is the problem line
echo '<p>You must be logged in to see this</p>';
};
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.