有人可以帮忙吗? 尝试为乐队的日历条目创建页面,以便他们可以在自己的网站上自行更新。
html输入页面:
<form action="addgigtimes.php" method="POST">
<fieldset class='multi'>
<legend><h5>Gig 1</h5></legend>
<label for='weekday' class='accessAid'></label>
<select id='weekday' name='weekday'>
<option value='' selected>Day of week</option>
<option value='Monday'>Monday</option>
<option value='Tuesday'>Tuesday</option>
<option value='Wednesday'>Wednesday</option>
<option value='Thursday'>Thursday</option>
<option value='Friday'>Friday</option>
<option value='Saturday'>Saturday</option>
<option value='Sunday'>Sunday</option></select>
<label for='day' class='accessAid'></label>
<select id='day' name='day'><option value='' selected>--Day--</option>
<option value='01'>01</option>
<option value='02'>02</option>
<option value='03'>03</option>
<option value='04'>04</option>
<option value='05'>05</option>
<option value='06'>06</option>
<option value='07'>07</option>
<option value='08'>08</option>
<option value='09'>09</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option></select>
<label for='month' class='accessAid'></label>
<select id='month' name='month'><option value='' selected>--Month--</option>
<option value='01'>01 (Jan)</option>
<option value='02'>02 (Feb)</option>
<option value='03'>03 (Mar)</option>
<option value='04'>04 (Apr)</option>
<option value='05'>05 (May)</option>
<option value='06'>06 (Jun)</option>
<option value='07'>07 (Jul)</option>
<option value='08'>08 (Aug)</option>
<option value='09'>09 (Sep)</option>
<option value='10'>10 (Oct)</option>
<option value='11'>11 (Nov)</option>
<option value='12'>12 (Dec)</option></select>
<label for='year' class='accessAid'></label><select id='year' name='year'>
<option value='' selected>--Year--</option>
<option value='2015'>2015</option>
<option value='2016'>2016</option>
</select>
venue
<input type="text" class="input" name="venue" />
location
<input type="text" class="input" name="location" />
time
<input type="text" class="input" name="time" />
</fieldset>
<button type="reset" style="border: 0; background: transparent">
<img src="images/reset.jpg" alt="reset" style="margin-right:19px "/>
</button>
<button type="submit" value="submit" style="border: 0; background:transparent">
<img src="images/submit.jpg" alt="submit" />
</button>
</form>
我将重复30次字段集代码,这样乐队一次最多可以输入30个演出。
这是php代码:
$sql = "DELETE FROM gigtimes";
$weekday = $_POST['weekday'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$venue = $_POST['venue'];
$location = $_POST['location'];
$time = $_POST['time'];
$rt=mysql_query("insert into guestbook(weekday,day,month,year,venue,location,time) VALUES ('$weekday','$day','$month','$year','$venue','$location','$time')");
echo mysql_error();
所以基本上删除数据库上已有的内容然后更新。 我只是不确定如何处理行ID?谁能解释一下 谢谢, Bettsy
答案 0 :(得分:0)
我有一个像生产网站一样的乐队,所以我知道你的痛苦。我做的一件事就是插入乐队名称,这样如果乐队想要删除某些内容,它会搜索他们的名字并删除该字段,例如:
$sql = "DELETE FROM gigtimes WHERE band_name = '$band_name'";
它并不完美,因为理论上可以是多个具有相同名称的波段,因此为了防止这种情况,请将波段名称设为唯一。这对我来说非常适合。如果您需要更多信息,请与我们联系。