PHP urlencode 函数
PHP urlencode functions
我在使用函数 urlencode
创建基于 'topicnaam' 的 'url' 列时遇到问题
我想要什么: 我想要我的 url 由 topicnaam 制作。但是 topicnaam 需要一个 url 编码,所以它们在 'url'
中没有空格和其他符号
I tried to use the urlencode()
function.
This is my table structure
我的 <form>
代码和更新函数
<?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');
}
我在使用函数 urlencode
我想要什么: 我想要我的 url 由 topicnaam 制作。但是 topicnaam 需要一个 url 编码,所以它们在 'url'
中没有空格和其他符号I tried to use the urlencode()
function.
This is my table structure
我的 <form>
代码和更新函数
<?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');
}