mercredi 4 juillet 2018

urlencode if if statement is true

I am trying it to make it when the urlis not given it will make an url based on the naam (boaNaam). I am doing this with urlencode. But I am not totally sure why this code isn't working for me. the line if(isset($_POST['boaUrl'])) { $q1['url'] = $app->check_string($_POST['boaUrl']); } Does work but the other if statement isn't working. I am not sure why not. Maybe it not going in the if statement or something like that.

if(isset($_POST['addBoard'])){
    $q1['ledenpagina_id'] = 1;
    $q1['board_naam'] = $app->check_string($_POST['boaNaam']);
    $q1['omschrijving'] = $app->check_string($_POST['boaOms']);
    if(isset($_POST['boaUrl'])) {
    $q1['url'] = $app->check_string($_POST['boaUrl']);
    } 
    if(!isset($_POST['boaUrl'])) {
    $q1['url'] = urlencode($q1['boaNaam']);   
    }
    $q1['icon'] = $app->check_string($_POST['faIcons']);
    $app->insert_query('boards', $q1);
}

This code down below does work but this code up here doens't

    if(isset($_POST['react_btn'])){              
      $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['editor1']);
      $q1['positie'] = $app->check_string($_POST['positie']);
      q1['url'] = urlencode($q1['topicnaam']);  
      $app->insert_query('topics', $q1);
      }  

Aucun commentaire:

Enregistrer un commentaire