php 值不打印

标签 php html

我正在尝试完成一项任务。为此,我需要打印 $message(在下面指定)。但它没有打印我不知道似乎是什么问题。我提前感谢你的帮助......我不想在 html 代码中做这个 echo $message 事情......还有一件事你应该知道值在 echo $message 之前打印. php 变量在 echo $message 之前有值,但是当我 echo $message 时,这些相同的变量什么也不打印。它只打印

客户姓名:

客户邮箱:

客户手机:

客户城市:

客户账单地址:

       <?php
if(isset($_POST['sub'])){

    $name=$_POST['name'];
    $email=$_POST['email'];
    $mobile=$_POST['mobile'];
    $city=$_POST['city'];
    $bill_add=$_POST['message'];
   echo $message="
     <html><head> </head>

      <body>
       Customer Name: <?php echo  $name; ?>
       <br>
          Customer Email: <?php echo $email; ?>
        <br>
         Customer Mobile: <?php echo $mobile; ?>
       <br>
        Customer City: <?php echo $city; ?>
      <br>
    Customer Billing Address: <?php echo .$bill_add; ?>
    </body></html>";}
      ?>

HTML 文件:

   <html>
     <body>
           <form id="contact_form" action="#" method="POST"                    
          enctype="multipart/form-data" style="  padding-left: 121px;">

      <div class="row">
      <label for="name" style="  margin-left: 9px;">Your name:</label><br />
      <input id="name" class="input" name="name" type="text" value="" 
     size="30" required/><br />
       </div>
           </br>
           <div class="row">
      <label for="email" style="  margin-left: 9px;">Your email:</label><br    
      />
      <input id="email" class="input" name="email" type="text" value="" 
      size="30" required/><br />
     </div>
     </br>
     <div class="row">
    <label for="email" style="  margin-left: 9px;">Mobile #:</label><br />
    <input id="email" class="input" name="mobile" type="text" value="" 
     size="30" required/><br />
    </div>
    </br>
    <div class="row">
    <label for="email" style="  margin-left: 9px;">City:</label><br />
    <input id="email" class="input" name="city" type="text" value="" 
    size="30" required/><br />
    </div>
    </br>
    <div class="row">
    <label for="message" style="  margin-left: 9px;">Shipping Address: 
     </label><br />
    <textarea id="message" class="input" name="message" rows="7" cols="32" 
     required></textarea><br />
     </div>
     </br>
     <div class="row">
     <input name="sub" id="submit_button" type="submit" value="Order Proceed 
      Now"  style="margin-top: 120px;background-color: green;padding:10px; 
     color:#FFF; "/>
     </div>
     </br>
    </form>                 
         </body>
       </html>

最佳答案

更改您的 $message到:

 echo $message="
     <html><head> </head>

      <body>
       Customer Name: $name
       <br>
          Customer Email: $email
        <br>
         Customer Mobile: $mobile
       <br>
        Customer City: $city
      <br>
    Customer Billing Address: $bill_add
    </body></html>";}
      ?>

问题是您使用的是 <?php echo进入<?php echo

关于php 值不打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31670652/

相关文章:

php - require_once 在开始时还是真正需要的时候?

php - 一条路线的 symfony2 .htaccess 重定向问题

php - 从android上传图片到mysql

html - :target does not work on my site

HTML/CSS 图像定位问题

javascript - 如何使用jquery检测特殊字符

php - str_replace 不适用于数据库返回

php - 您可以在 index.php - Fat Free Framework 中使用配置文件中的全局变量吗?

php - 如何将动态生成的 <tr> 发送到下一页

javascript - Jquery 未获取最新输入值