2014-06-20 12:02
浏览 50


I am working with PHP forms. The opening form tag looks like this:

<form name="adv_search_form" action="<?php echo $targetpage; ?>" method="GET">

This generated the following HTML:

<form name="adv_search_form" action="index.php?&amp;rel=common_listing&amp;module=company&amp;sort_option=&amp;search_option=&amp;show_max_row=15" method="GET">

When I submit this form, I land on a URL:


But what I want is that


should be appended to the action URL on the landing page. Can anyone suggest any good method for doing this? Thanks in advance.

图片转代码服务由CSDN问答提供 功能建议

我正在使用PHP表单。 开始表单标记如下所示:

 &lt; form name =“adv_search_form”action =“&lt;?php echo $ targetpage;?&gt;”  method =“GET”&gt; 


 &lt; form name =“  adv_search_form“action =”index.php?&amp; amp; rel = common_listing&amp; amp; module = company&amp; amp; sort_option =&amp; amp; search_option =&amp; amp; show_max_row = 15“method =”GET“&gt; 


  http:// localhost / projectcode12may2014 / ampanel  /index.php?field%5B%5D=broker_name&adv_operation%5B%5D=LIKE&value%5B%5D=&query_type%5B%5D=AND&submit=Submit


?field%5B%5D = broker_name&amp; adv_operation%5B%5D = LIKE&amp; value%5B%5D = &amp; query_type%5B%5D = AND&amp; submit = Submit

应附加到着陆页上的操作网址中。 任何人都可以提出任何好方法吗? 提前谢谢。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • duan5801 2014-06-20 12:06

    If you are using method="get" the parameters in action are overwritten. Only what is in the from will be transmitted.

    You need to add hidden fields for all these values. For example:

    <input type="hidden" name="module" value="company" />
    解决 无用
    打赏 举报
  • dongpao1083 2014-06-20 12:07

    That is your from data.

    You have method="get" in your form tag. This means that the form data is concatinated to the URL. Use method="post" to have send form data as a POST request and keep your URI clean.

    So change this line

    <form name="adv_search_form" action="<?php echo $targetpage; ?>" method="GET">

    to this

    <form name="adv_search_form" action="<?php echo $targetpage; ?>" method="post">

    Then you can access your form data in PHP with the global $_POST var which holds an array with the submitted data.

    解决 无用
    打赏 举报
  • dongmubi4444 2014-06-20 12:08

    This is a normal behavior. Using GET method discard all parameters specified directly in action attribute.

    Use POST method instead or move parameters from action attribute of the form to input fields with type="hidden".

    解决 无用
    打赏 举报

相关推荐 更多相似问题