我的页面的URL是一样的东西http://localhost/coursera/instructor/course.php?id=1&name=web%20development§ion=overview
,并在该网页上我有一个像
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<div class="form-group">
<textarea class="form-control" placeholder="What will students need to know or do before starting this course? Who is your target student? At the end of my course, students will be able to..." rows="8" required="" name="description"></textarea>
</div>
<button type="submit" class="btn btn-info btn-fill btn-block" name="overview">Save</button>
</form>
形式,但问题是<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>
和<?php echo $_SERVER["PHP_SELF"];?>
不与所有的$ _Get值返回相同的URL。
无论如何,使表单返回到同一页面,因为我不能硬编码$ _Get值。
谢谢。
编辑:
print_r($_SERVER["PHP_SELF"]);
是显示/coursera/instructor/course.php
但我想http://localhost/coursera/instructor/course.php?id=1&name=web%20development§ion=overview
任何方式做到这一点?
'的print_r($ _ SERVER)',看看你可以用什么 –
@Federkun我想,当我提交表单我应该返回到相同的URL,但它不是 – Phoenix