I've seen many posts with problems like this but i couldn't find a right answer that worked out. The problem is that i have a code that says if ... is empty, make variable ... (see code below). This variable is a form and in this form you have things like name, message etc. What i want is the placeholder of the name, if user is logged in to be his name, which is saved in my database. This is the code:
$action = isset($_POST["action"]) ? $_POST["action"] : ""; if (empty($action)) { // Send back the contact form HTML $output = "<div style='display:none'> <div class='contact-top'></div> <div class='contact-content'> <h1 class='contact-title'>Stuur een bericht voor hulp:</h1> <div class='contact-loading' style='display:none'></div> <div class='contact-message' style='display:none'></div> <br><br><form action='#' style='display:none'> <input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' placeholder='Naam*' /><br><br> <input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' placeholder='Email*' /><br><br>"; And this is what i want but what doesn't work:
<input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' placeholder=', " if (logged_in() === true) {echo $user_data["name"] } else { echo 'Naam'; } " ,' /><br><br> Hope someone can help, thanks in advance,
Paul
(naam = name in my language)
<?php ?>at your input