PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Ok, i'm extremely new to PHP and would like to ask for some help. I'm trying to create a registraton formfor a website that will be password protected. This is what i have; This is register-exec.php
You have 2 places in your code where you call the die() function. Both with the message 'Query failed'. This means your query could be stopping at either one. Replace them with
then paste the error you are receiving. Also, you should use 'mysql_real_escape_string()' when you write data to your database because you are risking SQL Injection otherwise.
<?php $qry = "INSERT INTO members (company name, login, password) VALUES('$cname','$login','".mysql_real_escape_string(md5($_POST['password']))."')"; ?>
From looking at the query, im guessing the 'company name' will be the problem, change it to company_name and see what happens. Also change the name in your table otherwise you will have the same problem.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Alright, great. That seemed to have helped get me past there. Now the page is going to http://www.englishlaundrylicensees.com/ ... r-exec.php instead of straight to the login page wher i thought i had it directed. Is there something wrong with the form code. Here is the code: This is the register-form.php
hmmmm...i didn't know there was a difference. I thought i was asking them to register there names in my MySQL database, and then they could use the login page whenever they wanted to log in. Is this not right? Told you i was new!
tkfrench wrote:hmmmm...i didn't know there was a difference. I thought i was asking them to register there names in my MySQL database, and then they could use the login page whenever they wanted to log in. Is this not right? Told you i was new!
Their details are written to a MySQL database.
tkfrench wrote:Or in the register-exec code do i have it pointed to the wrong place?
It's possible that the problem is there. Please paste the code of that page.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
So i tried a couple of things and it still isn't working. When i click register the on the page it directs me too the register-exec.php which it is supposed to reading and then executing to send me to the login page. I'm not sure what is going on.
tkfrench wrote:So i tried a couple of things and it still isn't working. When i click register the on the page it directs me too the register-exec.php which it is supposed to reading and then executing to send me to the login page. I'm not sure what is going on.
Would you be able to edit the first post and put the names of the pages right before the code? Also, I am not understanding what you mean by it should be redirecting to register-exec.php. The only pages I know of are register-success.php and register-form.php You may want to make the program echo a number everytime it passes a stage. Then you will know how far it has reached in your program, and can help you pin point your error.
I labeled the two different codes. One in the first post the other in the third. Here is the link to the registration form. When you fill it out and click register it doesn't go where i intended it to. I'm trying to get it to go to the login-form.php and instead it isgoing to the register-exec.php. Thanks for the help.
If I am understanding what you are trying to do,that should be what you want. The logic im seeing is: register-form.php->register-exec.php . If this is the logic, then I think that change may be what you are looking for. If its not correct,post up again
That does seem to send it to the right page but i don't think the registration-exec.php form is being utilized if you do that. I want someone to be able to go to the register-form.php page fill it out and if it validates the information then send it to the login-form.php. So, they can then login on the password protected website these pages will link to. I need the members able on the MySQL to store there registration information. Which is what i am trying to do with the register-exec.php. I may have some of this confused on how it works.
Why dont you just have it do everything in one page? Have the user type the stuff on the page you had setup ( I saw it already) and have it post to another page. Use the second page to do all of the validation (check if the user is valid,query the database,etc,etc) and if all is fine, redirect them to the page you want to. If you plan to use this method, you may want to read up on sessions,which would be a great way to make sure the user doesn't lose access from page to page.