私はこのPHPコードが...再びDBにニュースを追加する方法と、それらを表示した後に?このコードは大丈夫ですか?
をあなたの助けが必要:私はDBにニュースを追加したい
<div style="width:100%; text-align:left; overflow:visible; margin-top:11px; margin-bottom:7px;" id="regpage">
<form action="" method="post">
<fieldset style="border:none;">
<label for="news" style="font-weight:normal;width:30%;float:left;display:block;"><p>this is the news field, you can write here:</p></label>
<textarea rows="3" cols="104" name="news"></textarea></br></br>
Choose news type: <select name="type" style="margin-top:5px;">
<option>1</option>
<option>2</option>
<option>2</option>
</select>
<input type="submit" name="addnews" value="add new news!" id="addnews" style="float:right; border:1px solid #999; background:#E4E4E4;
margin-top:5px; padding-bottom:2px;"/>
</fieldset>
</form>
</div>
、と示すために後:
<?
if(isset($_POST['addnews'])){
$type = $_POST['type'];
$news = $_POST['news'];
$date = date("d-m-Y");
$memip = $_SERVER['REMOTE_ADDR'];
if($news == NULL){
$final_report.= "ALERT - Please enter something in the field with the news!";
}else{
if($type = '' AND NULL){
$final_report.= "ALERT - Please choose something from the checklist or you will die in pain!";
}else{
$create_news = mysql_query("INSERT INTO `lisnews` (`id`,`type`,`news`,`date`,`ip`) VALUES('','$type','$news','$date','$memip')");
$final_report.="<meta http-equiv='Refresh' content='0; URL=../admin/add-news.php'/>";
}}}
?>
そして、このフォームをそれらはページ上にあります。 。。(あなたはこれがあまりにもあなたから非常に非常に素晴らしいだろうと助けることができれば、すべての
よろしく
formタグ内の空白 'action'はちょうど' は '同じページへのリンクであるのと同様に、フォーム自体に提出することができます。 –
あなたの言ったことはやったことがありますが、何も変わっていません... –
あなたの投稿に新しいコードを編集するのはどうですか? –