从php表单输入不在其他页面中填充值[关闭]

I have read multiple questions posted and am unable to locate one that directly answers what I am trying to accomplish. I have tried several suggestions in other posting answers but still have not the results I am seeking.

I am trying to get input to populate on my sample page (single2.php) from single_name form.

Here is the code on single_name.php:

<form name="singlename" method="post" action="./single2.php" id="Form1" onsubmit="return Validatesinglename(this)">
<div id="wb_Text1" style="position:absolute;left:10px;top:15px;width:81px;height:16px;z-index:0;text-align:left;"><span style="color:#000000;font-family:Arial;font-size:13px;">Name:</span></div><input type="text" id="name" style="position:absolute;left:101px;top:15px;width:198px;height:23px;line-height:23px;z-index:1;" name="name" value="" autocomplete="off">
<div id="wb_Text2" style="position:absolute;left:10px;top:45px;width:81px;height:16px;z-index:2;text-align:left;"><span style="color:#000000;font-family:Arial;font-size:13px;">Gender:</span></div><input type="text" id="gender" style="position:absolute;left:101px;top:45px;width:198px;height:23px;line-height:23px;z-index:25;" name="Gender" value="">
<div id="wb_Text3" style="position:absolute;left:10px;top:75px;width:81px;height:16px;z-index:4;text-align:left;"><span style="color:#000000;font-family:Arial;font-size:13px;">Date of Birth:</span></div><input type="date" id="dob" style="position:absolute;left:101px;top:75px;width:198px;height:23px;line-height:23px;z-index:5;" name="dob:" value="" autocomplete="off">
<div id="wb_Text4" style="position:absolute;left:10px;top:105px;width:81px;height:16px;z-index:6;text-align:left;"><span style="color:#000000;font-family:Arial;font-size:13px;">Message:</span></div><input type="text" id="message" style="position:absolute;left:101px;top:105px;width:198px;height:23px;line-height:23px;z-index:7;" name="Message:" value="" autocomplete="off">
<input type="submit" id="Button1" name="" value="Send" style="position:absolute;left:101px;top:135px;width:96px;height:25px;z-index:8;">
<input type="reset" id="Button2" name="" value="Reset" style="position:absolute;left:207px;top:136px;width:96px;height:25px;z-index:9;">
</form>

and here is what is on single2.php:

<div id="wb_Text1" style="position:absolute;left:428px;top:514px;width:515px;height:391px;text-align:center;z-index:29;">
   echo $_POST["name"]; 
}
?></strong></span><span style="color:#000000;font-family:Chancellor;font-size:19px;">
<br>
<br>
Local Origin of Name:&nbsp; Unique and Original<br>From the name
<?php
{
   echo $_POST["name"]; 
}    <br>
<br>
Evaluation Meaning:&nbsp; Festive, Joyous
<br>
<br>
<strong>&#0042;</strong> Emotional Spectrum <strong>&#0042;</strong>
<br>
Up front and honest
<br>
<strong>&#0042;</strong> Personal Integrity <strong>&#0042;</strong>
<br>
Friends know that
<?php
{
   echo $_POST["name"]; 
?>
can be called on in a crisis.
<br>
<strong>&#0042;</strong> Personality <strong>&#0042;</strong>
<br>
Life in the fast lane, tempered by common sense.
<br>
<strong>&#0042;</strong>&nbsp; Relationships <strong>&#0042;</strong>
<br>
Stays true and loyal
<br>
<br>

<?php
{
   echo $_POST["name"]; 
}
?>    is a 
<?php
{
   echo $_POST["gender"]; 
}
?>
<br>
<br>
{
   echo $_POST["name"]; 
}
?>
was born 
<?php
{
   echo $_POST["dob"]; 
}
?>
<br>
<br>
</span>
<span style="color:#000000;font-family:Georgia;font-size:27px;"><strong><em>
<?php
{
   echo $_POST["message"]; 
}
?></em></strong>
</span>

I can get the "name" to post at each place, but the "gender", "dob" and "message" does not post.

Any help would be greatly appreciated.

You spelled your names wrong on single_name.php

name="Gender"
name="dob:"
name="Message:"

You must use the same names (lowercase without colon)

<input name="Gender" >#name should be 'gender' not 'Gender'
<input name="dob:" >#name should be 'dob' not 'dob:'
<input name="Message:" >#name should be 'message' not be 'Message:'

for future the name of your input name should match up with your post value as well as being case sensitive so 'Gender' !== 'gender' and so forth

 name="name"
 name="Gender" 
 name="dob:"
 name="Message:" 

So, post should be of the same case

$_POST['name']
$_POST['Gender']
$_POST['dob:']
$_POST['Message:']

Your names do not match as stated. Easy way to see what is coming across is to add a debug tag in your Single_2.php page of : print_r($_POST); this will "mess up your page" while used but will allow you to see the entire $_POST array with keys and data that is coming across. Then you can check names etc.

To see the array in a more readable format right mouse click and "inspect element"

try to insert such debug code and see what keys are stored in your POST array:

echo '<pre>'
var_dump($_POST);

And also try not to use special symbols in your input names, because this example will not work proprely:

$_POST['dob:'] = 'somevalue';

foreach($_POST as $key=>$value){
    $$key = $value;
}

Cut and paste the following corrected code into your application. It has been tested and works fine.

"single_name.php" is as follows:


<form id="Form1" action="./single2.php" method="post" name="singlename" onsubmit="return Validatesinglename(this)">

<div id="wb_Text1" style="position: absolute; left: 10px; top: 15px; width: 81px; height: 16px; z-index: 0; text-align: left;">
    <span style="color: #000000; font-family: Arial; font-size: 13px;">Name:</span></div>
<input id="name" autocomplete="off" name="name" style="position: absolute; left: 101px; top: 15px; width: 198px; height: 23px; line-height: 23px; z-index: 1;" type="text" value="">

<div id="wb_Text2" style="position: absolute; left: 10px; top: 45px; width: 81px; height: 16px; z-index: 2; text-align: left;">
    <span style="color: #000000; font-family: Arial; font-size: 13px;">Gender:</span></div>
<input id="gender" name="gender" style="position: absolute; left: 101px; top: 45px; width: 198px; height: 23px; line-height: 23px; z-index: 25;" type="text" value="">

<div id="wb_Text3" style="position: absolute; left: 10px; top: 75px; width: 81px; height: 16px; z-index: 4; text-align: left;">
    <span style="color: #000000; font-family: Arial; font-size: 13px;">Date 
    of Birth:</span></div>
<input id="dob" autocomplete="off" name="dob" style="position: absolute; left: 101px; top: 75px; width: 198px; height: 23px; line-height: 23px; z-index: 5;" type="date" value="">

<div id="wb_Text4" style="position: absolute; left: 10px; top: 105px; width: 81px; height: 16px; z-index: 6; text-align: left;">
    <span style="color: #000000; font-family: Arial; font-size: 13px;">Message:</span></div>
<input id="message" autocomplete="off" name="message" style="position: absolute; left: 101px; top: 105px; width: 198px; height: 23px; line-height: 23px; z-index: 7;" type="text" value="">

<input id="Button1" name="" style="position: absolute; left: 101px; top: 135px; width: 96px; height: 25px; z-index: 8;" type="submit" value="Send">
<input id="Button2" name="" style="position: absolute; left: 207px; top: 136px; width: 96px; height: 25px; z-index: 9;" type="reset" value="Reset">
</form>

and "single2.php" is as follows:

<div id="wb_Text1" style="position: absolute; left: 428px; top: 514px; width: 515px; height: 391px; text-align: center; z-index: 29;">

<?php echo $_POST["name"];  ?>  
</strong></span><span style="color: #000000; font-family: Chancellor; font-size: 19px;">
<br><br>
Local Origin of Name:&nbsp; Unique and Original<br>From the name 
<?php echo $_POST["name"];?>
<br>
<br>
Evaluation Meaning:&nbsp; Festive, Joyous
<br>
<br>
<strong>&#0042;</strong> Emotional Spectrum <strong>&#0042;</strong>
<br>
Up front and honest
<br>
<strong>&#0042;</strong> Personal Integrity <strong>&#0042;</strong>
<br>
Friends know that 
<?php echo $_POST["name"]; ?> 
can be called on in a crisis. <br><strong>&#0042;</strong> Personality <strong>&#0042;</strong>
<br>Life in the fast lane, tempered by common sense. <br><strong>&#0042;</strong>&nbsp; 
Relationships <strong>&#0042;</strong> <br>Stays true and loyal <br><br>
</span></div>

<?php //following for debug
echo 'Name is : '.$_POST["name"].'<br>'; 
echo 'Gender is : '.$_POST["gender"].'<br>'; 
echo 'Date of Birth is : '.$_POST["dob"].'<br>'; 
echo 'Message is : '.$_POST["message"].'<br>'; 
?>