简体   繁体   中英

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

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.

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?

Try to do this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM