Solution to form submission

Source: Internet
Author: User
I am a newbie to submit a form. All N forms must be submitted to the same page for data processing, that is, writing data to the database. Add. php & lt; formaction = & quot; adddate. php & quot; method = & quot; POST & quot; id = & quot; form1 & quot; name = & quot; fo form submission
I am a newbie. please take a look.
All N forms must be submitted to the same page for data processing, that is, writing data to the database.
Add. php

Add2.php


Add3.php


Adddate. phpHow should I write this page?

$ Con = mysql_connect ("localhost", "root ","");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}

// Some code
Mysql_select_db ("survey", $ con );


$ SQL = "insert INTO information (t1)
VALUES ('. $ t1 ')";
If (! Mysql_query ($ SQL, $ con ))
{
Die ('Error: '. mysql_error ());
}
Echo "script" alert ('OK! 1 record added') script ";
Mysql_close ($ con );



?>


Thank you for choosing adddate. php.
This is a function problem that I don't quite understand.


------ Solution --------------------
Add different parameters to the action of each form to differentiate processing:
PHP code
  # Add. php # add2.php # add3.php
------ Solution --------------------
If (isset ($ _ POST [t1])
$ SQL = "insert INTO information (t1) VALUES ('{$ _ POST [t1]}')";
If (isset ($ _ POST [t1])
$ SQL = "insert INTO information (t2) VALUES ('{$ _ POST [t2]}')";
If (isset ($ _ POST [t1])
$ SQL = "insert INTO information (t3) VALUES ('{$ _ POST [t3]}')";

No function is required.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.