Jump to content

PHP registration->server error


speedy_rudolf

Recommended Posts

Hi. I'm trying to build a sort of blog where users have to register to post questions/comments. My problem is with the registration part. Here is part of the code:

 

<form name="registration" method="post" action="registration.php">
<tr><td align="left">Nume</td>
<td align="right"><input type="text" name="name" onKeyUp="validare()"></td></tr>
<tr><td align="left">Email</td>
<td align="right"><input type="text" name="email" onKeyUp="validare()"></td></tr>
<tr><td align="left">Username</td>
<td align="right"><input type="text" name="username" onKeyUp="validare()"></td></tr>
<tr><td align="left">Parola</td>
<td align="right"><input type="password" name="password" onKeyUp="validare()"></td></tr>
<tr><td align="left">Confirmare parola</td>
<td align="right"><input type="password" name="pass_conf" onKeyUp="validare()"></td></tr>
<tr><td align="left">Anti-spam</td>
<td><script type="text/javascript">DrawBotBoot()</script></td></tr>
<tr><td></td><td><input type="submit" name="register" value="Inregistreaza-te" disabled="true"></td></tr>
</form>...
</html>

 

<?php
$host="mysql3.***************";
$username="a7129718_root";
$password="hello2";
$db_name="a7129718_site";
$tbl_name="members";
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT MAX(id) AS Maxa_id FROM $tbl_name";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);

if ($rows) {
$Max_id = $rows['Maxa_id']+1;}
else {
$Max_id = 1;}

$name=$_POST['name'];
$email=$_POST['email'];
$user=$_POST['username'];
$pass=$_POST['password'];

$sql2="INSERT INTO $tbl_name(id, name, email, username, password)VALUES('$Max_id', '$name', '$email', '$user', '$pass')";
$result2=mysql_query($sql2);

if($result2){
header("location:login.html");}
else{
echo "cannot insert into table";}}
?>

 

The problem is: there is no error message. The server just redirects me to their error page, which doesn't contain any error code, just some ads. Can you tell me what the problem might be? Thank you in advance. Bye."

Link to comment
Share on other sites

Is the record being inserted into the database?

 

And it might be a good idea to edit out your DB username and password . . .

 

no. The "error" occures before the record being inserted.

 

yeah...as it turns out, it was an error/bug on the server's end. it couldn't correctly process the form. it works just fine now. thanks.

Link to comment
Share on other sites

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.