Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP URL编码函数_Php_Html_Mysql_Url_Encode - Fatal编程技术网

PHP URL编码函数

PHP URL编码函数,php,html,mysql,url,encode,Php,Html,Mysql,Url,Encode,使用函数urlencode 我想要什么:我想要由topicnaam创建的url。但是topicnaam需要一个urlencode,因此它们在“url”中没有空格和其他符号 和更新功能的我的代码 <?php if(isset($_POST['react_btn'])){ unset($q1); $q1['topicnaam'] = $app->check_string($_POST['topicnaam']); $q1['board_id'] = $app-&

使用函数
urlencode

我想要什么:我想要由topicnaam创建的url。但是topicnaam需要一个urlencode,因此它们在“url”中没有空格和其他符号

和更新功能的我的代码

<?php
  if(isset($_POST['react_btn'])){
   unset($q1);
   $q1['topicnaam'] = $app->check_string($_POST['topicnaam']);
   $q1['board_id'] = $app->check_string($_POST['boardid']);
   $q1['klant_id'] = $app->check_string($_POST['klantid']);
   $q1['ledenpagina_id'] = $app->check_string($_POST['ledenpaginaid']);
   $q1['omschrijving'] = $app->check_string($_POST['topicomschrijving']);
   $app->insert_query('topics', $q1, 'id');
   }  

  ?> 
   <form action="" method="post">
     <div class="form-group">
      <label for="comment">Topicnaam:</label>
      <textarea class="form-control resizenone" name="topicnaam" rows="1" id="comment" required></textarea>
       <input type="hidden" name="klantid" value="<?php echo $_SESSION["klant_id"] ?>">
       <input type="hidden" name="boardid" value="<?php echo $actiefboardid ?>">
       <input type="hidden" name="ledenpaginaid" value="<?php echo $_SESSION["ledenpagina_id"]; ?>">
       <label for="comment">Topic omschrijving:</label>
       <textarea class="form-control resizenone" name="topicomschrijving" rows="3" id="comment required"></textarea>
       <button type="submit" name="react_btn" class="btn btn-primary">Voeg topic toe</button>
       </div>              
   </form>

主题:
在这里找到它

if(isset($_POST['react_btn'])){
    $base_URL = 'https://yousitename.com/'

    unset($q1);
    $q1['topicnaam'] = $app->check_string($_POST['topicnaam']);
    $q1['board_id'] = $app->check_string($_POST['boardid']);
    $q1['klant_id'] = $app->check_string($_POST['klantid']);
    $q1['ledenpagina_id'] = $app->check_string($_POST['ledenpaginaid']);
    $q1['omschrijving'] = $app->check_string($_POST['topicomschrijving']);
    $q1['url'] = $base_URL.urlencode($q1['topicnaam']);
    $app->insert_query('topics', $q1, 'id');
}  

谢谢你的朋友!成功了。我不得不稍微调整一下代码,但我让它工作了。