简体   繁体   English

如何在不显示地址栏中的值的情况下将值发送到下一页

[英]How can i send the values to the next page without the showing the values in the address bar

Here am sending a value month from a page to a php file named printall.php on clicking an image print.png. 这里是一个值页面从页面发送到一个名为printall.php的php文件,点击图片print.png。 I get that value in printall.php by using GET method. 我通过使用GET方法在printall.php中获得该值。 I find the value of of month displaying in the address bar of the window which opens printall.php on Clicking print.png. 我发现月份的值显示在窗口的地址栏中,该窗口在Clicking print.png上打开printall.php。

I want to hide or encode the value which displays in the address bar. 我想隐藏或编码地址栏中显示的值。 Is that anyone to help me out with this little doubt ? 有人帮我解决这个小疑问吗?

<a href="javascript:;" onclick="window.open('printall.php?id=<?php echo $month;?>');"><img src="print.png" width="25px" height="22px" style="border:0;" ></a>

You could create a form in the page that uses post and invisible fields. 您可以在页面中创建使用后期和不可见字段的表单。 Then using javascript then set the month on the invisible field and submit it. 然后使用javascript然后在隐形字段上设置月份并提交它。

Is $month the value of the current month, or is it based on user input? $ month是当月的值,还是基于用户输入? If it is the value of the current month, don't bother sending it to your PHP script, just use PHP's native datetime functions: 如果它是当前月份的值,请不要将其发送到您的PHP脚本,只需使用PHP的本机日期时间函数:

echo date('m'); // would echo 08 since current month is August

If $month is somehow based on user input, either of the other 2 answers would work, using AJAX or by submitting a form. 如果$ month以某种方式基于用户输入,则其他2个答案中的任何一个都可以使用AJAX或提交表单。

you can make POST submits with JavaScript; 你可以使用JavaScript提交POST; libraries like jQuery have nice Ajax utility functions. 像jQuery这样的库具有很好的Ajax实用功能。

PHP $_POST Function PHP $ _POST函数

The built-in $_POST function is used to collect values from a form sent with method="post". 内置的$ _POST函数用于从使用method =“post”发送的表单中收集值。

Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. 使用POST方法从表单发送的信息对其他人不可见,并且对要发送的信息量没有限制。

Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file). 注意:但是,默认情况下,POST方法的最大大小为8 Mb(可以通过在php.ini文件中设置post_max_size来更改)。

Ex. 防爆。

<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

Url look like 网址看起来像

http://www.w3schools.com/welcome.php

Source: w3schools 资料来源:w3schools

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

相关问题 如何在地址栏中保留输入错误的URL,同时仍向用户显示未找到的页面? - How can I keep a mistyped URL in the address bar while still showing a not found page to the users? 我如何使用php从另一页的多个值中获取下一页的单个值 - how can i get single value at next page from multiple values in another page using php 如何在地址栏中访问网址已更改的页面 - How can i access a page with changed url in address bar 如何在每个页面的地址栏中保持相同的 url? - How can I keep the same url in the address bar for every page? 如何将 JQuery 值传递到下一个 PHP 页面? - How do I pass JQuery values to next PHP page? 如何在不使用输入获取值的情况下将数据发送到数据库? - How can I send datas to the database without use inputs to get values? 如何在jQuery提交中发送表单值而不将其放入表单中? - How can I send form values in jQuery submit without putting them in the form? 如何发送用户上传页面,而不显示响应 - How I can send the user to upload page instead showing the response 如何在不显示电子邮件地址的情况下将电子邮件发送到其他地址? - How do I send an email to different addresses without showing the email address? 我如何将 ajax function 值从一个页面发送到另一个页面 - How do i send ajax function values from a page to another
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM