Author Topic: PhP help!!!  (Read 298 times)

royjr

  • New Member
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
PhP help!!!
« on: August 25, 2010, 12:21:29 PM »
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
----------------------
 
Code: [Select]

 <?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>   


phphelp

  • Administrator
  • Senior Member
  • *****
  • Posts: 780
  • Karma: +3/-0
    • View Profile
    • PHP Help forum
Re: PhP help!!!
« Reply #1 on: August 27, 2010, 08:00:05 AM »
You need to either use forward slashes in path, or escape backslashes. Because combination \r is interpreted as CR (carriage return).

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

correct too:
PHP Code: [Select]
<?php include("../menu/register.php"); ?>
Are you experienced in PHP programming and willing to share your knowledge?
Join us at php help forum!