PhP help!!!

My Error in a menu include

Warning: include(…\menu egister.php) [function.include]: failed to open stream: Invalid argument in C:\Abyss Web Server\htdocs\members\register.php on line 26

Warning: include() [function.include]: Failed opening ‘…\menu egister.php’ for inclusion (include_path=’.;C:\php5\pear’) in C:\Abyss Web Server\htdocs\members\register.php on line 26

MY code

 <?php
 require_once('common.php');
 if (isset($_POST['submitBtn'])){
  // Get user input
  $username  = isset($_POST['username']) ? $_POST['username'] : '';
  $password1 = isset($_POST['password1']) ? $_POST['password1'] : '';
  $password2 = isset($_POST['password2']) ? $_POST['password2'] : '';
        
  // Try to register the user
  $error = registerUser($username,$password1,$password2);
 } 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>Rawhi M - Register</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Register</h1>
</br>
<?php include("..\menu\register.php"); ?>
<div id="main">
<?php if ((!isset($_POST['submitBtn'])) || ($error != '')) {?>
      <div class="caption">Register user</div>
      <div id="icon">&nbsp;</div>
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="registerform">
        <table width="100%">
          <tr><td>Username:</td><td> <input class="text" name="username" type="text"  
/></td></tr>
          <tr><td>Password:</td><td> <input class="text" name="password1" type="password" 
/></td></tr>
          <tr><td>Confirm password:</td><td> <input class="text" name="password2" 
type="password" /></td></tr>
          <tr><td colspan="2" align="center"><input class="text" type="submit" 
name="submitBtn" value="Register" /></td></tr>
        </table>  
      </form>
     
<?php 
}   
    if (isset($_POST['submitBtn'])){
?>
      <div class="caption">Registration result:</div>
      <div id="icon2">&nbsp;</div>
      <div id="result">
        <table width="100%"><tr><td><br/>
<?php
 if ($error == '') {
  echo " User: $username was registered successfully!<br/><br/>";
  echo ' <a href="login.php">You can login here</a>';
  
 }
 else echo $error;
?>
  <br/><br/><br/></td></tr></table>
 </div>
<?php            
    }
?>
 <div id="source">Rawhi M</div>
    </div>
</body>   

You need to either use forward slashes in path, or escape backslashes. Because combination \r is interpreted as CR (carriage return).

correct:
[php]<?php include("..\\menu\\register.php"); ?>[/php]

correct too:
[php]<?php include("../menu/register.php"); ?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service