滚动到id PHP函数
我有一个表单,在提交时刷新页面并显示错误。我只需要它滚动回表单。这是表单标签:滚动到id PHP函数,php,Php,我有一个表单,在提交时刷新页面并显示错误。我只需要它滚动回表单。这是表单标签: <form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'> 如何将#联系人添加到函数中 谢谢 这里不需要php。将要跳转到的元素的id作为锚点附加到操作字段 e、 g 及 action=“#contactus”不起作用吗?为什么
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
如何将#联系人添加到函数中
谢谢 这里不需要php。将要跳转到的元素的id作为锚点附加到操作字段 e、 g 及
action=“#contactus”不起作用吗?为什么使用php?同意。在GetSelfScript()
方法中,将#contactus
附加到返回值中,或者直接在action
属性中执行。您可以更具体一些吗?我对PHP非常陌生。对您的答案进行一点编辑即可:
function GetSelfScript()
{
return htmlentities($_SERVER['PHP_SELF']);
}
<form id="contactUs" action="target.php#contactUs" />
<form id='contactus' action='<?php echo $formproc->GetSelfScript(); ?>#contactus' method='post' accept-charset='UTF-8'>
function GetSelfScript($anchor = null)
{
$anchor = $anchor === null ? '' : '#' . $anchor;
return htmlentities($_SERVER['PHP_SELF']) . '#' . $anchor;
}
<form id='contactus' action='<?php echo $formproc->GetSelfScript("contactus"); ?>#contactus' method='post' accept-charset='UTF-8'>