Roughly speaking, I am making a program that inputs keywords in the search form, extracts information from the database, and displays it on the result screen. What I want to do is to install a button to update the contents of the database on the result screen and update it normally. However, when I installed a button to move to the same page and clicked the button,Notice: Undefined indexIt will come out.
The probable cause is that you jumped directly to the result screen without going through the input screen, but if you try rewriting the contents of the database and pressing the update button, the contents will be rewritten according to the first entered word. Since the contents have changed properly, it seems that the post data was automatically retransmitted. However, I'm not sure because I thought it was an error that occurred when the entered information was empty.
How can I hide this error?
Corresponding source code//Search screen
<form method = "post" action = "kekka.php">
<input type = "text" name = "aa">
<input type = "submit" value = "search button">
</form>
// Result screen
<? php
** ~ Database password information ~ **
$name = $_POST ['aa'];
** ~ Select statement that displays the contents of the database based on the searched word ~ **
?>
<head>
<meta charset = "utf-8">
<title>select</title>
</head>
<body>
-Button to refresh the screen (act on the same page)-
** ~ Output part ~ **
</body>
</html>
-
Answer # 1
-
Answer # 2
Processing when receiving $_GET, $_POST, etc. --Qiita has an article that summarizes the basic idea to some extent.
for your information.
-
Answer # 3
I was able to solve it by using a php session.
Thanks to takasima20 for giving me the word "hold".
Thank you everyone for your answers!
Related articles
- php - in mamp environment, search window results result in error
- php - i want to get the number of search results (index number) of "site: ~" on google
- php - in wordpress 1 i want to display only fixed pages and 2 search results excluding specific categories
- php - in-site search results in wordpress are not displayed properly
- php - i am making a customer search system by studying, but i want to be able to connect to a database, but it does not work
- php - at the time of narrowing down search: i want to make a conditional branch when checking only parent terms or checking both
- php - how to refine your search for custom posts
- php - how can i narrow down the search to a fixed page?
- what is suitable for displaying the search results in the c # database?
- java - i want to perform search evaluation of board games without using recursive expressions
- php - the posting screen can be displayed without going through the login screen
- edit user information of each logged-in user without using db in php
- taxonomy-i want to implement a refined search on my custom taxonomyphp page
- seo - google search results for urls with #
- php - i want to search wordpress in real time
- some files are not searched by glob function (file search) of php
- php - i want to create a member site in wordpress without using a plugin
- php artisan route: cache results in error
- php - want to customize wordpress bbpress site search results
- python - you may need to restart the kernel to use updated packages error
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to check the type of a shell script variable
- i want to call a child component method from a parent in vuejs
For the time being, please consider branching by REQUEST_METHOD of $_SERVER.
Also use filter_input.
The rest depends on what kind of configuration you are trying to operate the function.
In some cases, ajax is also an effective method. In some cases.