Thank you very much for your support.
I want to post a value with javascript and receive it with php, but I can't post it well. A php error also appears.
function postform () is a modified version of what was picked up from the web, and is not well understood.
Anyone who knows how to do it, thank you.
Sender
<head>
<meta http-equiv = "Content-Type" content = "text/html;charset = utf-8">
<title>T&E G.K. Work continuation support type A offices (rack)</title>
<style type = "text/css">
// ~ Omitted ~
</style>
<script language = "javascript" type = "text/javascript">
function checkStr () {
// ~ Omitted ~
}
function checkMail () {
// ~ Omitted ~
}
function check_kuhaku () {
var str1 = document.getElementById ("userid"). value;
var str2 = document.getElementById ("password"). value;
if ((! str1) || (! str2)) {
alert ("Required fields are blank");
return false;
} else {
page_jump ();
return false ();
}
}
function page_jump () {
var str1 = document.getElementById ("userid"). value;
var str2 = document.getElementById ("password"). value;
postform ('userid', str1);
postform ('password', str2);
window.location.href = "customer_registration.php";
return false;
}
function postform (name, value) {
var form = document.createElement ('form');
var request = document.createElement ('input');
form.method = 'POST';
form.action = 'customer_registoration.php';
request.type = 'hidden';
request.id = name;
request.name = name;
request.value = value;
form.appendChild (request);
document.body.appendChild (form);
form.submit ();
}
</script>
</head>
<body>
</br>
<form method = "post">
Login ID
<input type = "text" name = "userid"
size = "25" onchange = "checkMail ()" />
password
<input type = "password" name = "password"
size = "25" onchange = "checkStr ()" />
</form>
</br>
<button type = "submit">Login</button>
</br>
<button>New registration</button>
</body>
</html>
Destination
<? php
if (isset ($_ POST ['userid'])) {
print "POST_userid:". $_ POST ['userid']. "<br/>";
} else {
print ("No value for $_POST [userid]");
}
if (isset ($_ POST ['password'])) {
print "POST_password:". $_ POST ['password']. "<br>";
} else {
print ("No value for $_POST [password]");
}
// ~ Omitted ~
Execution result
Notice: Undefined variable: _POST [userid] value is missing in C: \ xampp \ htdocs \ LUCK \ customer_registration.php on line 44
Notice: Undefined variable: _POST [password] has no value in C: \ xampp \ htdocs \ LUCK \ customer_registration.php on line 49
-
Answer # 1
-
Answer # 2
I have specified multiple postform () ,
sample
Every time postform is called, a dummy form is submitted
Also, it seems that the part with id is competing with the existing idSender
Destination
"; print "POST_password:". htmlspecialchars ($password). "
"; }
Related articles
- php - i want to receive the db id with $_post [] but i can't
- i want to run javascript only the first time
- i want to run php on nginx (win10)
- dart - i want to send curl with flutter, but i get an error
- i want to list the tables in the db with php so that i can edit each record
- post is not reflected in php
- javascript - i want to display the progress with ajax xhr
- python - i want to open a file with an absolute path
- php - about compiling javascript code in laravel development
- javascript - i want to reduce the hp gauge
- javascript - i want to handle html data attribute with js
- php - i want to see the oss service, but i can't find the code
- php - i can't sync with rsync from the browser
- php - i want to set the judgment of 0 to true in empty
- javascript - i want to get spreadsheet data in json using gus
- php - i want to get rid of shortcodes from the_excerpt ();
- i want to decode with sql server
- javascript - i want to add forms side by side with appendchild
- python - i want to move images with pygame
- (django) i can't post with images
- javascript : reCaptcha v3 will return an error
- javascript : How to connect a custom registration form to the database?
- javascript : The modal window opens only for one record
- php : Ajax, Privat24-api: invalid signature error
- javascript : Best Platform for Site Performance (PageSpeed Insights)
- javascript : Replacing blocks at the touch of a button
- javascript : Refreshing the HTML page
- javascript : Autocomplete input with selectable search?
- javascript : create a service for email verification [closed]
- Passing php variable to javascript
postform ()
is implemented to execute POST sending process every time it is executed, soIn this calling method, "requests containing only userid" and "requests containing only password" are fired respectively.
Notice: Undefined variable:
is displayed because of double quotes, such asprint ("$_ POST [userid] has no value");
This is because the string literal using is passed to print.PHP tries to expand a variable if it is contained in a string literal enclosed in double quotes. It is an error to try to expand
$_ POST [userid]
because there is no such value. (To be more precise, I feel like I'm moss trying to resolve the subscriptuserid
first)If you just want to process it as a string, it must be enclosed in single quotes.
PHP: Strings-Manual