是否可以在html中创建联系表单?

问题描述 投票:-1回答:1

我想建立一个网站,其中包括一个访问者将填写的调查问卷。这是我拥有的:

<html>
<head>
</head>
<body>
<form method="post" action="index.php">
<label>Name:</label>
<input name="name" placeholder="Name">

<label>Email:</label>
<input name="email" type="email" placeholder="Email">

<label>Price:</label>
<select name="price" option="Free,1p - £1,£1 - £5,£5 - £10,£10 - £20,£20+"

<label>Comment:</label>
<textarea name="message" placeholder="Do you want to say anything else?"></textarea>

<input id="submit" name="submit" type="submit" value="submit">

</form>
</body>
</html>

大多数都有效,我不能因为某种原因让下拉工作。你能帮帮忙吗?

html contact-form
1个回答
1
投票

你的<select>元素是错误的。你需要孩子<option>s。见这里:https://www.w3schools.com/html/html_form_elements.asp

所以,更像是:

<select name="price">
    <option value="0">Free</option>
    <option value="0to1">1p - £1</option>
    <option value="1to5">£1 - £5</option>
    <!-- etc -->
</select>
© www.soinside.com 2019 - 2024. All rights reserved.