基本上,如果有任何编辑,第一个表格将获取数据,点击保存将重定向到上面的PHP代码。
但是我没有在表单中保存编辑而且我收到错误。请告诉我如何解决这个问题!
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="control-label mb-10">Google Analytics Code</label>
<textarea class="form-control" rows="10" id="ganalytics" class="form-control" name="ganalytics"><?php echo $ganalytics;?>"</textarea>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label class="control-label mb-10">Facebook Pixel Code</label>
<textarea class="form-control" rows="10" id="fbpixel" class="form-control" name="fbpixel"><?php echo $fbpixel;?>"</textarea>
</div>
</div>
</div>
PHP代码:
if (isset($_POST['save']))
{
$fbpixel= $_POST['fbpixel'];
$ganalytics= $_POST['ganalytics'];
echo $fbpixel;
echo $ganalytics;
}
答案 0 :(得分:0)
您的代码上有"
错字
改变
<textarea class="form-control" rows="10" id="fbpixel" class="form-control" name="fbpixel"><?php echo $fbpixel;?>"</textarea>
到
<textarea class="form-control" rows="10" id="fbpixel" class="form-control" name="fbpixel"><?php echo $fbpixel;?></textarea>
和这个
<textarea class="form-control" rows="10" id="ganalytics" class="form-control" name="ganalytics"><?php echo $ganalytics;?>"</textarea>
到
<textarea class="form-control" rows="10" id="ganalytics" class="form-control" name="ganalytics"><?php echo $ganalytics;?></textarea>