0

I would like to use the data entered in the html form and insert into MYSQL. I have a separate php (cus.php). but nothing is happening with current code I have

at the moment when I click "register" I'm nav to the php file. Thank you

4
  • 3
    Unrelated to your current problem: you really should escape your input values through mysql_real_escape_string or, even better, use PDO. Commented Apr 10, 2012 at 18:19
  • Not sure if this will break your code, don't have time to double check it all... but currently you have $conn = mysql_connect('???????', $user, $pass); Why not put $conn = mysql_connect('localhost', $user, $pass); Commented Apr 10, 2012 at 18:20
  • 1
    @Zanrok Not all web hosts use localhost for databases. GoDaddy is a notable one, and if @Badr is using something like that, he wouldn't want his database server's IP/hostname on the web. I think ????? is just a placeholder. Commented Apr 10, 2012 at 18:24
  • @ceejayoz, thanks, ya I just thought it was odd seeing that in his code. Commented Apr 10, 2012 at 18:25

3 Answers 3

4

You forgot the most important thing about an HTML form: the <form> tag.

You have to wrap the whole form (all inputs) which should be submitted when clicking like this:

<form method="POST" action="cus.php">
...
</form>

This will send all inputs to cus.php and make them available there as variables $_POST['input_name']. You can alternatively use GET as the method (and then use the $_GET array instead).

Edit: Didn't see it, you actually do have a form tag. However it's missing the target file in its action attribute.

Sign up to request clarification or add additional context in comments.

Comments

1

First, see DCoder's comment. It's the most important.

Change:

<form action="" method="seller">

To:

<form action="cus.php" method="post">

Does that fix it?

7 Comments

sorts the issue to an extent, I now get "This web page has not been found" when I click register.
Great! Now where is your cus.php in relation to this file? In the same directory, above or below? It seems they're in separate locations which is what is causing that error.
They are all placed in the same folder "demo" :( edit: edited it when I press reg it opens .php.
Very odd. And it's exactly "cus.php" not "CUS.php" or anything like that? Be sure to check everything in terms of file extension. When you get the "not found" message, if you look at the URL in the address bar, does it look correct?
What's the URL? It sounds like a server problem unless you forgot to open your PHP tag at the beginning.
|
0

Try to do this

FORM action="your script" method="Post"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.