ErHunt
ErHunt

Reputation: 311

Insert to MySQL using HTML form

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

Upvotes: 0

Views: 309

Answers (3)

Alitlili
Alitlili

Reputation: 66

Try to do this

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

Upvotes: 0

tcole
tcole

Reputation: 927

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?

Upvotes: 1

Armatus
Armatus

Reputation: 2191

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.

Upvotes: 4

Related Questions