If it's the tag value in HTML, how do I get it in PHP?

Source: Internet
Author: User
Html:
Recommended

Php:
$sql = "INSERT into Info_look (new_class) VALUES (' $_post[new_class_info] ')";

Yesterday sent a post, thank you for your help, there is a question at the time didn't think, is I $_post[new_class_info] here to get is the value, here I want to write, if written [new_class_info.value],php in the . is not the meaning of the +? Ask for answers

PS: And friends remind me that user input variables can not be inserted directly into SQL, because I am a beginner, here has not considered security issues, so currently only need to pass in value, can let my database record on it, thank you

Reply content:

Html:
Recommended

Php:
$sql = "INSERT into Info_look (new_class) VALUES (' $_post[new_class_info] ')";

Yesterday sent a post, thank you for your help, there is a question at the time didn't think, is I $_post[new_class_info] here to get is the value, here I want to write, if written [new_class_info.value],php in the . is not the meaning of the +? Ask for answers

PS: And friends remind me that user input variables can not be inserted directly into SQL, because I am a beginner, here has not considered security issues, so currently only need to pass in value, can let my database record on it, thank you

Your name attributes should be set on the select element. When a form is submitted, the form element is committed as a name-value pair, and the value of the attribute for the element is the name of the property, as the value of the attribute of the element select select name option value .

Like what

    

If the first option is checked, the foo=bar1 name value pair will be submitted.

If you commit using the Post method, you can use the $_POST array to access it in PHP, for example, the form above will have $_POST['foo'] this member, the value is 'bar1' .

Upstairs has been said very well, do not know the landlord understand no, I come to add some, the landlord said This is included in the (form) under this tag, defines the Action property indicates where the form is to be submitted, that is, your PHP. At the time of submission, the contents of the form key-value such a key value to your Php,key is the Name property of this tag, and value is the Value property, so the post to PHP is similar to this [' New_class_info ' = > ' recommend ', so all you have to do is get this array New_class_info item for example: $_post[' new_class_info ']

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.