简体   繁体   English

如何从标题为example.com的页面传递表单?a = 100?

[英]How to pass form from a page with header as example.com?a=100?

There is a form in adminhome.php?action=addbook named addbook adminhome.php?action=addbook有一个名为addbook

<form name="addbook" action="adminhome.php?action=addbook" method="get" onsubmit="validatenumber();">
     Code:<br/><input type="text" name="code" ><br/>
     Class:<br/><input type="number" name="class" id="class1"><br/>
     title:<br/><input type="text" name="title"><br/>
     price:<br/><input type="number" name="price" id="price"><br/>
     quantity:<br/><input type="number" name="quantity" id="quantity"><br/>
     category:<br/><input type="text" name="category"><br/>
     <input type="submit" value="submit"><br/>
 </form>

What should be the correct action in the form action attribute given below? 在下面给出的表单操作属性中,正确的操作应该是什么?

action="adminhome.php?action=addbook&addbook.php" 

Actually when I submit form it is not getting validated. 实际上,当我提交表单时,它没有得到验证。

<script language="javascript">
    function validatenumber(){
        var class1=document.getElementByName("class")[0];
        if(parseInt(class1.value, 10) < 0){
            alert("Please enter positive integer");
            return false;
        }
    }
</script>

 <form name="addbook" action="adminhome.php" method="get" onsubmit="validatenumber();"> Code:<br/><input type="text" name="code" ><br/> Class:<br/><input type="number" name="class" id="class1"><br/> title:<br/><input type="text" name="title"><br/> price:<br/><input type="number" name="price" id="price"><br/> quantity:<br/><input type="number" name="quantity" id="quantity"><br/> category:<br/><input type="text" name="category"><br/> <input type="hidden" name="action" value="addbook"> <input type="submit" value="submit"><br/> </form> 

That would make all of the form inputs and the action available in the $_GET[] global in file adminhome.php 这将使所有表单输入和操作在文件adminhome.php中的$ _GET []全局变量中可用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript:如何在同一域中从“example.com/page1”重定向到“example.com/page2”? - JavaScript: how to redirect from “example.com/page1” to “example.com/page2” in same domain? 内容安全策略标头的 *.example.com 是否也与 example.com 匹配? - Does a *.example.com for a content security policy header also match example.com? 如何从Angular中形式为example.com/path#p1=v1&amp;p2=v2…的URL中提取查询参数 - How to extract query parameters from URL of form `example.com/path#p1=v1&p2=v2…` in Angular “if(location.href!= example.com/page1 || example.com/page2)”更改CSS元素 - “if (location.href != example.com/page1 || example.com/page2)” Change CSS element 如何将portnumber(example.com:1234)更改为(example.com)? - How can I change the portnumber (example.com:1234) to something like (example.com)? 如何在example.com/s/keyword上创建搜索结果页面? - How can I create search result page on example.com/s/keyword? 即使我已允许 https://example.com/ 从源“https://example.com”访问已被阻止 - Access from origin 'https://example.com' has been blocked even though I've allowed https://example.com/ 如何在不触发重新加载的情况下将URL哈希设置为“”(例如example.com/#hash-&gt; example.com/)? - How to set URL hash to “” ((e.g. example.com/#hash --> example.com/) without triggering a reload? 同源策略导致来自www.example.com的example.com的Ajax请求被拒绝? - Same origin policy causes Ajax requests to example.com from www.example.com to be denied? 除了http://example.com,我如何扩展此正则表达式以匹配www.example.com? - How do I extend this regex to match www.example.com in addition to http://example.com?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM