-2

これは、答えが非常に単純であると私が信じている小さな問題ですが、木には木が見えない可能性があります。

データを表示するフォームがあります。ユーザーはデータを編集するように求められます。これにより、データベースが更新され、更新されたデータが記載された電子メールが送信されます。メールは届きますが、タイトルは表示されますがデータは表示されません。

私は何を間違っていますか?

メールに表示されるテキスト:

名前:
メール:
電話:

phpコード:

$email_to = 'someone@here.com';
$name=$row['name'];
$email=$row['email'];
$phone=$row['mobtel'];
$email_subject = 'Feedback from website';
$headers = 'From: someone@there.com\r\n';

someone$message='Name:  ' .$name. "\r\n". 'Email:  ' .$email. "\r\n". 'Phone:  ' .$phone;


$sent = mail($email_to, $email_subject, $message, $headers);


 if($sent) 
 {print "Your mail was sent successfully"; }
 else 
 {print "We encountered an error sending your mail"; }

これは、上記に先行する php コードです。

mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
    mysql_select_db($dbname) or die("Unable to connect: " . mysql_error());

    if (isset($_GET['view']))
    {
    $user = sanitizeString($_GET['view']);




    $data = "SELECT * FROM names WHERE id='$user'";
    $result=mysql_query($data) or die(mysql_error());

    while($row=mysql_fetch_array($result)){

?>


    <caption>Personal Record</caption>

<tr>
<th>ID</th>
    <td><?php
        echo $row['id'];
     ?></td>
</tr>

<tr>
<th>Name</th>
    <td><?php
        echo $row['name'];
     ?></td>
</tr>

<tr>
<th>E-Mail</th>
    <td><?php
        echo $row['email'];
     ?></td>
</tr>

<tr>
<th>Main Telephone</th>
    <td><?php
        echo $row['maintel'];
     ?></td>
</tr>

<tr>
<th>Mobile Telephone</th>
    <td><?php
        echo $row['mobtel'];
     ?></td>
</tr>

<tr>
<th>Organisation</th>
    <td><?php
        echo $row['organisation'];
     ?></td>
</tr>

<tr>
<th>Group Leader</th>
    <td><?php
        echo $row['group_leader'];
     ?></td>
</tr>

<tr>
<th>Supervisor</th>
    <td><?php
        echo $row['supervisor'];
     ?></td>
</tr>

<tr>
<th>Volunteer</th>
    <td><?php
        echo $row['volunteer'];
     ?></td>
</tr>

<tr>
<th>Assessor</th>
    <td><?php
        echo $row['assessor'];

        }
        }
     ?></td>
</tr>

</table>


    <br />
    <form method="post" action="update.php">
        <input name="Submit1" type="submit" value="Edit" style="width: 67px" /></form>

    <p>&nbsp;</p>
4

3 に答える 3

2

someone$messageおそらく$message

于 2012-04-26T11:07:19.537 に答える
1

送信済みにsomeone$messageを追加するのを忘れました。

于 2012-04-26T11:06:15.083 に答える
0

最初にこれsomeone$messageを変更して$message、コードを実行します。おそらく、配列に$row値がないように見えることが理由です。$row[]または使用を確認するにはprint_r($row); :-)

于 2012-04-26T11:12:03.387 に答える