Hey. So here is my code...

config.php

<?php

$localhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "test2";

$connect = mysql_connect($localhost, $dbuser, $dbpass);
mysql_select_db("$dbname", $connect);

?>

regprocess.php

<?php
include"config.php";

$username = $_POST['username'];
$email = $_POST['email'];
$password = md5($_POST['password']);

$insert = 'INSERT into users(username, email, password) VALUE("'.$username.'","'.$email.'","'.$password.'")';

mysql_query($insert);

?>

register.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#apDiv1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 34%;
    top: 195px;
}
#apDiv1 form table tr td {
    font-family: "Trebuchet MS";
}
</style>
</head>

<body>
<div id="apDiv1">
<form method ="post" action="regprocess.php">
    <table width="300" border="0">
      <tr>
        <td width="134">Username:</td>
        <td width="156"><input type="text" name="username"/></td>
      </tr>
      <tr>
        <td><p>Email:</p></td>
        <td><p>
          <input type="email" name="email"/>
        </p></td>
      </tr>
      <tr>
        <td><p>Password:</p></td>
        <td><p>
          <input type="password" name="password"/>
        </p></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><p>
          <input type="submit" name="submit" value="Submit"/>
        </p></td>
      </tr>
    </table>
  </form>
  </div>

</body>
</html>

And my error is: When I hit submit, my browser simply displays the code from my regprocess.php

So I assume there is an error either within my config or regprocess codes.
I have double checked both my database and table names.

Recommended Answers

All 2 Replies

regprocess.php, line 2: make sure you have a space between the include command and the filename.

include"config.php";

Also, regprocess.php doesn't produce any output. Although, I don't believe this should cause the code to be printed, I suggest adding some print statements, a redirect, or something.

Actually, it could be that your server is not configured to process PHP properly. Can you set up a basic test script and check your output as per this example?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.