Concatenating strings retrieved from form $_Post in php

有些话、适合烂在心里 提交于 2021-01-29 17:53:43

问题


I am posting a string through an HTML form with the following code:

<html>
<body>
<form name="form" enctype="multipart/form-data" action="test.php" method="post">
         <input name="message" 
         type="text" value=""><br/><br/>
        <input type="submit" value="Upload"/><br/>
         </form>
         </body>
         </html>

The code for test.php is the following:

   <?php
   $string1 = '$_POST["message"]';
   $og_url = "http://thepropagator.com/facebook/testapp/issue.php?name=".$string1;
echo $og_url;
   ?>

The problem I'm having is that the posted string "$string1" does not seem to be showing at the end of the URL "http://thepropagator.com/facebook/testapp/issue.php?name=" that I am trying to concatenate it with. Can anyone please explain what I'm doing wrong?


回答1:


I think you want $string1 = $_POST['message'];, no quotes. Though I'd expect your code to come up with http://thepropagator.com/facebook/testapp/issue.php?name=$_POST["message"] url.



来源:https://stackoverflow.com/questions/8874019/concatenating-strings-retrieved-from-form-post-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!