0

投稿された複数の質問を読みましたが、達成しようとしていることに直接答える質問を見つけることができません。他の投稿の回答でいくつかの提案を試みましたが、まだ求めている結果が得られません。

single_name フォームからサンプル ページ (single2.php) に入力する入力を取得しようとしています。

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>

ここに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>

それぞれの場所で「名前」は投稿できますが、「性別」「生年月日」「メッセージ」は投稿されません。

どんな助けでも大歓迎です。

4

6 に答える 6

0

次の修正済みコードをコピーしてアプリケーションに貼り付けます。テスト済みで、正常に動作します。

「single_name.php」は以下の通りです。


<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>

「single2.php」は次のとおりです。

<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>'; 
?>
于 2013-05-26T01:27:11.613 に答える
0

このようなデバッグ コードを挿入して、POST 配列に格納されているキーを確認してください。

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

また、この例は適切に機能しないため、入力名に特殊記号を使用しないようにしてください。

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

foreach($_POST as $key=>$value){
    $$key = $value;
}
于 2013-05-26T00:52:30.963 に答える