需要能够添加无限的输入字段,如果用户按下按钮“pievienot vel”,如果按下按钮,还需要添加更多的表行。抱歉,如果答案在某处,就是找不到。目前我只能添加一个以上的输入字段和表中的一行不按按钮。对php和html也是新手,所以不要评判我的代码:)
需要任何帮助!:)
<h3> Personīgā informācija </h3>
<div id="Personal">
<label>Vārds: </label>
<input name="Name" type="text" size ="30"
<?php
if(isset($_POST['create'])) {
echo "value='".$_POST['Name']."'";
} else {
echo "placeholder='Vārds'";
}
?>
/> <br /><br />
<label>Uzvārds: </label>
<input name="Surname" type="text" size ="30" value="" placeholder='Uzvārds' /> <br /><br />
<label>Dzimšanas gads: </label>
<input name="DOB" type="text" size ="15" value="" placeholder="Dzimšanas Gads" /> <br /><br />
<label>E-pasts: </label>
<input name="Email" type="text" size ="30" value="" placeholder="E-pasta adrese" /> <br /><br />
</div>
<h3> Izglītības informācija
<button class="educationbtn" name="education" onclick="addText();" > Pievienot vel </button>
</h3>
<div id="Education" name="Educationdiv">
<label>Iestādes nosaukums: </label>
<input name="EdName[]" type="text" size ="30" value="" placeholder="Iestādes nosaukums" /> <br /><br />
<label>Gads no - līdz: </label>
<input name="Year1[]" type="text" size ="10" value="" placeholder="No" />
<input name="Year2" type="text" size ="10" value="" placeholder="Līdz" /> <br /><br />
<label>Specialitāte: </label>
<input name="Specialitate[]" type="text" size ="30" value="" placeholder="Specialitāte" /> <br /><br />
</div>
<?php
if(isset($_POST['education']))
{
?>
<label>Iestādes nosaukums: </label>
<input name="EdName[]" type="text" size ="30" value="" placeholder="Iestādes nosaukums" /> <br /><br />
<label>Gads no - līdz: </label>
<input name="Year1[]" type="text" size ="10" value="" placeholder="No" />
<input name="Year2" type="text" size ="10" value="" placeholder="Līdz" /> <br /><br />
<label>Specialitāte: </label>
<input name="Specialitate[]" type="text" size ="30" value="" placeholder="Specialitāte" /> <br /><br />
<?php
}
?>
<h3> Valodu zināšanu informācija
<button class="languagebtn" name="language"> Pievienot vel </button>
</h3>
<div id="Language">
<table style="center" style="width:100%">
<tr>
<th> Valoda </th>
<th> Runātprasme </th>
<th> Lasītprasme </th>
<th> Rakstītprasme </th>
</tr>
<tr>
<td> <input name="Lvtext" type="text" size ="10" value="Latviešu" readonly /> </td></td>
<td> <input name="LvRunat" type="text" size ="20" value="" /> </td>
<td> <input name="LvLasit" type="text" size ="20" value="" /> </td>
<td> <input name="LvRakstit" type="text" size ="20" value="" /> </td>
</tr>
<tr>
<td> <input name="Engtext" type="text" size ="10" value="Angļu" readonly /> </td></td>
<td> <input name="EngRunat" type="text" size ="20" value="" /> </td>
<td> <input name="EngLasit" type="text" size ="20" value="" /> </td>
<td> <input name="EngRakstit" type="text" size ="20" value="" /> </td>
</tr>
<tr>
<td> <input name="Rustext"type="text" size ="10" value="Krievu" readonly /> </td></td>
<td> <input name="RusRunat" type="text" size ="20" value="" /> </td>
<td> <input name="RusLasit" type="text" size ="20" value="" /> </td>
<td> <input name="RusRakstit" type="text" size ="20" value="" /> </td>
</tr>
<?php
if(isset($_POST['language']))
{
?>
<tr>
<td> <input name="Extext"type="text" size ="10" value="" /> </td></td>
<td> <input name="ExRunat" type="text" size ="20" value="" /> </td>
<td> <input name="ExLasit" type="text" size ="20" value="" /> </td>
<td> <input name="ExRakstit" type="text" size ="20" value="" /> </td>
</tr>
<?php
}
?>
</table>
<br /><br />
</div>
<input type="submit" name="create" class="button" size="10" value="Create CV" />
<br /><br />
<br /><br />
1条答案
按热度按时间hlswsv351#
你可以这样做:
然后可以在所需的按钮中使用onclick='addnewinput'属性。
这是一个例子,但我认为这可以让您了解如何在javascript中为您的表单实现它。希望能对你有所帮助。