PHP Basics Tutorial: Form Gets the value of a radio button

Source: Internet
Author: User
Tags php basics php tutorial
<p> Definition and Usage &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A radio box is used when a user chooses one of several given choices. <br/> Syntax &lt;input type= "Radio" name= "Sex" value= "male" &gt; Male <br/> &lt;input type= "Radio" name= "Sex" value= "female" &gt; Female <br/> Parameter Description type&nbsp; The type of the form. One of the radio represents a radio button. &LT;BR the name of the/> name option. You can define your own name. <br/> Value is a radio button values, the above example "male" corresponds to the value is male, "female" corresponding to the value is "female" <br/> instance &lt;? Php<br/> If ($_post[submit]== "submit") {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; If the user submits the data <br/> &nbsp;&nbsp;&nbsp;   echo "You have chosen". $_post[sex]; The value of the output radio button <br/>}<br/>? &gt;<br/> &lt;html&gt;<br/> &lt;head&gt;<br /> &lt;meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "&gt;<br/> &lt;tItle&gt; get the value of a radio button-www.dushuwu.net&lt;/title&gt;<br/> &lt;/head&gt;<br/> &lt; body&gt;<br/> &lt;form name= "Form1" method= "Post" action= "&AMP;LT;? =$_server[' php_self '?&gt; " &gt;<br/> &nbsp;&nbsp;&nbsp; Male: <br/> &lt;input type= "Radio" checked= "Checked" name= "Sex" value= "male" &gt;<br/> &lt;br &gt;<br/> Female: <br/> &lt;input type= "Radio" name= "Sex" value= "female" &gt;<br/> &lt; Input type= name= "Submit" value= "Submission" &gt;<br/> &lt;/form&gt;<br/> &lt;/body& Gt;<br/> &lt;/html&gt; </p>

The above is the basic PHP Tutorial: Form Gets the value of the radio button to get the content, more relevant content please follow topic.alibabacloud.com (www.php.cn)!

  • Related Article

    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.