본문 바로가기
Web/Html

*매우매우중요 html 기초 태그5. form, input 활용

by 개발에정착하고싶다 2022. 9. 27.

 

# 기본 입력 폼

<h1>Hotel Feedback</h1>

<form action="other.html">

<p>Are you from Inside or Outside USA?</p>
<label for="in">Inside: </label>
<!-- loc의 의미는 location이다.
특징으로는 location뿐 아니라 정말 중요한 개념인데
동일한 name의 공간. 이를테면 name으로 설정된 값이 모두 on이라고 한다면
on이라는 공간 안에서는 선택을 1개밖에 할수없다.
name이 처음의 것이 in이고 두번째의 것이 out이라면
중복으로 선택이 가능하다. 이유는 name이 중복의 영역이 아니라
각각의 영역이기 때문이다. -->
<input type="radio" id='in' name="loc" value="out">

<br>

<label for="out">Outside</label>
<input type="radio" id='out' name='loc' value="in">

<br>
<input type="submit">
</form>


# 리스트 출력형 중 선택 폼

 

<h1>Hotel Feedback</h1>

<form action="other.html">


<p>How was your service?</p>
<select name="stars" id="">
    <option value="Great">3</option>
    <option value="Ok">2</option>
    <option value="Bad">1</option>
</select>

<br>
<input type="submit">

</form>


# 장문 형 입력 폼

<h1>Hotel Feedback</h1>

<form action="other.html">

<p>Any other comments?</p>

<textarea name="" id="" cols="30" rows="10"></textarea>

<br>
<input type="submit">

</form>