So I have this problem where if I do this.
<input type="text" name="adres" value='.$adres.'>
it only shows the first word of the submitted value.
(Please note that this is like a confirmation check the actual data is already sent on a different form)
altho, if I do echo $adres
; (I am echoing it out of the form, just to check if $_POST had the right value with it) it will just show it all, while if I do this in the input value it will only show the first word I really don't know why it does that, and can't seem to find a fix for it.
<?php
$postcode = $_POST['postcode'];
$email = $_POST['email'];
$naam = $_POST['naam'];
$commentaar = $_POST['comment'];
$plaats = $_POST['woonplaats'];
$adres = $_POST['adres'];
echo '<h3>Factuur Gegevens</h3>
<section>
<label class="label">Naam: </label>
<label class="input">
<i class="icon-append fa-user"></i>
<input type="text" name="naam" value='.$naam.'>
</label>
</section>
<section>
<label class="label">Adres: </label>
<label class="input">
<i class="icon-append fa-home"></i>
<input type="text" name="adres" value='.$adres.'>
</label>
</section>
<div class="row">
<section class="col col-8">
<label class="label">Woonplaats: </label>
<label class="input">
<input type="text" name="woonplaats" value='.$plaats.'>
</label>
</section>
<section class="col col-4">
<label class="label">Postcode: </label>
<label class="input">
<input type="text" name="postcode" value='.$postcode.'>
</label>
</section>
</div>
<section>
<label class="label">Email: </label>
<label class="input">
<i class="icon-append fa-envelope"></i>
<input type="text" name="email" value='.$email.'>
</label>
</section>
<section>
<label class="label">Comment</label>
<label class="textarea">
<i class="icon-append fa-comments"></i>
<textarea rows="4" name="comment" >'. $commentaar .'</textarea>
</label>
</section>';
function emailcheck(){
global $email;
if(filter_var($email, FILTER_VALIDATE_EMAIL)) {
echo "Yay valid email <br>";
}
else {
echo " booh, wrong email :c";
}
}
function postcodecheck() {
global $postcode;
if(preg_match('/^[1-9]{1}[0-9]{3}[[:space:]]?[a-z]{2}$/i', $postcode)) {
echo "<br> Yay, valid postcode ( $postcode )";
}
else {
echo "Booh, wrong postcode :c";
}
}
?>
The outcome looks like this http://i.imgur.com/mvl2jLq.png
Can someone help me out here? Jordy
I am guessing the address is multi-line and you are trying to stick it in an input box, so only the first line of the address is showing. Try a <textarea></textarea>
instead.
Try like this,
<input type="text" name="adres" value="'.$adres.'">
Instead of
<input type="text" name="adres" value='.$adres.'>
You are missing the quotes around value:
<input type="text" name="adres" value="'.$adres.'">