I just switched webhosting companies and I'm having a major problem now, I keep getting errors that I wasn't getting before. Mainly, these right here:

Notice: Undefined index: username in D:\hshome\c274056\test.yourroommatefinder.com\register\signup.php on line 12

Here's line 12:

$username = mysqli_real_escape_string($dbc, trim($_POST['username']));

Tried this too:

$username = mysqli_real_escape_string($dbc, trim($_POST['username']));

What could be causing this, I even tried it without the mysql real escape. I have the site up on another server, currently with no problems and i have the error set to show the same.

Recommended Answers

All 4 Replies

The server it is working on probably has notices turned off. You should have an if (isset($_POST['username'])) block around that anyway.

The server it is working on probably has notices turned off. You should have an if (isset($_POST['username'])) block around that anyway.

Worked like a charm. Thank you.

actually now I'm having another issue with it, when it returns sticky date (i.e. the form not completely filled out), it returns a 1 for each field. However, if the form is completed it submits the data to to mysql as is?

What should I check, I'm at a complete lost with this. Like I said, I had no issues on the other server so I'm really confused.

Figured it out, instead of just echoing the defined variable name, I have to use $_POST; and it works perfect now.

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.