我的网站是我的音乐家页面here.它允许人们进来看我的照片,新闻,我的音乐和我正在玩的事件.
一切都在膨胀,我手动将数据输入MysqL,让它自动提供给主页.现在我正在添加控制面板,以便我可以从Web添加,编辑和删除数据库中的内容.
除了添加/编辑事件的能力之外,一切正常.我把它缩小到我无法输入2个URL或我收到此错误的事实.我需要输入2个网址(一个用于查看活动页面,一个用于购买门票)但我一次输入的数量不能超过1个,是否有任何我可以做的纠正或解决此错误,无论是在apache还是我的码?
<?PHP $specevlink = "http://facebooklink.com"; $specgigtick = "http://ticketplacelink.com"; ?> <form method="post" action="index.PHP?page=editgigs"> <table> <tr> <td> Event Page (Link): </td> <td style="text-align: left;"> <input type="url" name="giglink" value="<?PHP echo $specevlink; ?>" /> </td> </tr> <tr> <td> Event Tickets (Link): </td> <td style="text-align: left;"> <input type="url" name="gigtick" value="<?PHP echo $specgigtick; ?>" /> </td> </tr> </table><br /> <input type="submit" name="editgig" value="submit" /><br /> <br /> </form>
编辑:
我正在添加完整的代码行,以便您可以确切地看到我正在使用的代码,
<?PHP if(isset($_GET["page"])){ $page = $_GET["page"]; } else { $page = ""; } if($page === "editgigs"){ include ('inc/logincheck.PHP'); ?> <div class="label"> EDIT GIGS </div><br /> <div style="margin: 0 auto; text-align: center; width: 100%"> <form method="post" action="index.PHP?page=editgigs"> <?PHP if(!isset($_POST['selectgigs'])){ if(!isset($_POST['updgigs'])){ ?> Select one of the options below:<br /> <br /> <select name="selgigs" style="max-width: 26%;"> <?PHP while($gigsall_data = MysqLi_fetch_array($gigsall_query)){ $gigid = stripslashes($gigsall_data['idgigs']); $gigdate = stripslashes($gigsall_data['date']); $gigname = stripslashes($gigsall_data['name']); $gigdate = date('F j,Y',strtotime($gigdate)); ?> <option value="<?PHP echo $gigid; ?>"> <?PHP echo $gigdate; ?>: <?PHP echo $gigname; ?> </option> <?PHP } ?> </select><br /><br /> <input type="submit" name="selectgigs" value="Select" /><br /> <br /> <?PHP } } if(isset($_POST['selectgigs'])){ $gigtoed = trim($_POST['selgigs']); $specgig_query = MysqLi_query($con,"SELECT * FROM `gigs` WHERE `idgigs` = '$gigtoed'") or die(MysqLi_error($con)); $specgig_data = MysqLi_fetch_array($specgig_query); $specdate = stripslashes($specgig_data['date']); $specname = stripslashes($specgig_data['name']); $specevlink = stripslashes($specgig_data['evlink']); $specgigtick = stripslashes($specgig_data['ticklink']); $specnos = stripslashes($specgig_data['noshow']); if($specnos === '0'){ $noshow = ''; } else { $noshow = 'checked'; } ?> <table style="border-spacing: 5px; padding: 10px;"> <tr> <td> Past Event?: </td> <td style="text-align: left;"> <input type="checkBox" name="nos" <?PHP echo $noshow; ?> /> Past Event </td> </tr> <tr> <td> Date: </td> <td style="text-align: left;"> <input type="date" name="gigdate" value="<?PHP echo $specdate; ?>" required /> </td> </tr> <tr> <td> Name: </td> <td style="text-align: left;"> <input type="text" name="gigname" value="<?PHP echo $specname; ?>" required /> </td> </tr> <tr> <td> Event Page (Link): </td> <td style="text-align: left; width: 350px;"> <input type="url" name="giglink" style="width: 100%;" value="<?PHP echo $specevlink; ?>" /> </td> </tr> <tr> <td> Event Tickets (Link): </td> <td style="text-align: left; width: 350px;"> <input type="url" name="gigtick" style="width: 100%;" value="<?PHP echo $specgigtick; ?>" /> </td> </tr> </table><br /> <input type="hidden" name="gigid" value="<?PHP echo $gigtoed; ?>" /> <input type="submit" name="updgigs" value="Update" /><br /> <br /> <?PHP } if(isset($_POST['updgigs'])){ $newid = trim($_POST['gigid']); $newdate = MysqLi_real_escape_string($con,trim($_POST['gigdate'])); $newname = MysqLi_real_escape_string($con,trim($_POST['gigname'])); $newlink = MysqLi_real_escape_string($con,trim($_POST['giglink'])); $newtick = MysqLi_real_escape_string($con,trim($_POST['gigtick'])); if(isset($_POST['nos'])){ $newnoshow = MysqLi_real_escape_string($con,'1'); } else { $newnoshow = MysqLi_real_escape_string($con,'0'); } echo $newid.' '.$newdate.' '.$newname.' '.$newlink.' '.$newtick.' '.$newnoshow.'<br />'; /*MysqLi_query($con,"UPDATE `gigs` SET `date` = '$newdate',`name` = '$newname',`evlink` = '$newlink',`ticklink` = '$newtick',`noshow` = '$newnoshow' WHERE `idgigs` = '$newid' LIMIT 1") or die(MysqLi_error($con));*/ //commented for testing ?> <div style="text-align: center;"> <span class="confirm"> Successfully updated click <a href="index.PHP?page=events">here</a> to view it! </span> </div> <?PHP } ?> </form> </div> <?PHP }
当我尝试使用以http://开头的链接时,我得到了406 Not Acceptable:
http://onkore.us/?blah=http://www.google.com
我试试这个很好:
http://onkore.us/?blah=www.google.com
您已经提到过,如果它有多个链接,您就会遇到问题,但是当我尝试使用下面的两个链接时,它很好:
http://onkore.us/?blah1=www.google.com&blah2=www.google.com
但是,您可以找到并修复可能特定于您的服务器配置的问题,或者您可以尝试解决此问题.
我不确定这种解决方法是否有帮助,但考虑到http://或https://正在创建问题,我的想法是从用户输入中删除http://和https://.首先,您可能希望尝试将< input type =“url”更改为< input type =“text”,以便不强制执行URL格式.然后,您可以使用Javascript在提交到服务器之前从表单中的用户输入中删除http://和https://的出现.此外,您可以在填充表单值之前从数据中删除这些. 希望这可以帮助 . 正则表达式:How to remove ‘http://’ from a URL in JavaScript