php获取html 文本框的值 两个文本框,出问题了
下面是我做的一个日历,输入查询的界面:
==================================================
//以下为程序
====================================================================================
我还定义了另一个php文件来获取 year 和 month 但是运行出来它把month的值覆盖到了year上,不过不给month赋值,相当于我只定义了name="year" 的文本框,而且取值部分变成了name="month"文本框的输入。当我把month文本框的 type 改成password 结果可以运行。不过输入的时候月份成了星星...所以问下,是什么问题?
回复讨论(解决方案)
想帮你,不过看不懂你说的意思,绕口了
不知道你遇到了什么问题?
print_r($_POST); 看看
想帮你,不过看不懂你说的意思,绕口了
就是比如说我输入了 年:2004 月:2
然后单击查询,然后编辑输出 得到的数字,代码是这样的:
====================================
$year=$_post["year"];
$month=$_post{"month"];
echo $year;
echo $month;
====================================
最后输出出来的内容:
=======
2
=======
就没了,然后我改一下,只输出$month,即把“echo $year;"删除,结果输出的内容:
========
========
什么都没有,然后我再改一下,只输出$year,即把“echo $month;”删除,加上“ echo $year"
结果输出的内容:
==========
2
==========
说明一个问题就是,程序执行的时候就直接把以year命名的文本框的内容没有赋值给$year,直接忽略了,
然后把以month命名的文本款的内容赋值给$year;还有一种情况就是,程序执行的时候先把以year命名的文本框的内容赋值给$year,然后又把以month命名的文本款的内容赋值给$year,而本来的$month没有赋值。
不知道你遇到了什么问题?
print_r($_POST); 看看
我试过了,详细问题在4楼我给解释了下,希望我写的还算清楚...
只要我把以month命名的文本框的格式改成password,就可以正常运行...
说明两个text 格式的文本框发生了冲突...
引用 2 楼 jordan102 的回复:不知道你遇到了什么问题?
print_r($_POST); 看看
我试过了,详细问题在4楼我给解释了下,希望我写的还算清楚...
只要我把以month命名的文本框的格式改成password,就可以正常运行...
说明两个text 格式的文本框发生了冲突...
搞错了...是三楼~
echo $_POST['year'].'=='.$_POST['month'];
我代码运行了一下,输出来的东西没看来有什么问题,年和月都可以显示啊
加个id试试?
另,
建议改为
$year=$_POST["year"];
$month=$_POST["month"]; //$_POST 大写
$year=$_ POST["year"];
$month=$_ POST {"month"];
echo $year;
echo $month;
加个id试试?
另,
建议改为
嗯,加ID就对了,谢谢啦~

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
