Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 10:42

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Weird simple html and PHP problem

Discussion on Weird simple html and PHP problem within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Weird simple html and PHP problem

I have problem with this script, script working fine and send mails but since i added this code textarea is acting strange it populate first few spaces with blank space, same on localhost and on live server

PHP Code:
<textarea><?php if (isset($_POST['body'])) { echo htmlentities($_POST['body']); } ?></textarea>
I tried to put it like this too and problem is still here

PHP Code:
<textarea value="<?php if (isset($_POST['body'])) { echo htmlentities($_POST['body']); } ?>"></textarea>
Im using that code so that script remember what user entered when error ocurr, that inputs save values, but problem is only on this field.

You can look here what i talk about, go in Message area, click inside and press CTRL + a and you will see what problem is its populated with blank space



PHP Code:
<form action="contact.php" method="POST">
    <ul>
        <li><label><strong>Email</strong></label></li>
        <li><input type="email" name="email" placeholder="Email" 
        value="<?php if (isset($_POST['email'])) { echo htmlentities($_POST['email']); } ?>"></li>
        <li>&nbsp;</li>
        <li><label><strong>Title</strong></label></li>
        <li><input type="text" name="title" placeholder="Title" 
        value="<?php if (isset($_POST['title'])) { echo htmlentities($_POST['title']); } ?>"></li>
        <li>&nbsp;</li>
        <li><label><strong>Message</strong></label></li>
        <li><textarea name="body" cols="40" rows="8">
        <?php if (isset($_POST['body'])) { echo htmlentities($_POST['body']); } ?>
        </textarea></li>
        <li>&nbsp;</li>
        <li><label><strong>Security check</strong></label></li>
        <li>5 + 3 = <input type="text" name="securecheck"></li>
        <li><input type="submit" name="send" value="Send" class="submit-button"></li>
    </ul>
</form>
mlukac89 is offline  
Old 02/16/2014, 01:10   #2

 
adistoe's Avatar
 
elite*gold: 63
Join Date: Oct 2012
Posts: 1,181
Received Thanks: 139
Try this:
PHP Code:
<li><textarea name="body" cols="40" rows="8">
<?php echo htmlentities(@$_POST['body']); ?>
</textarea></li>
adistoe is offline  
Old 02/16/2014, 11:59   #3
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
still doesn't work i dont know why on other fileds works normal

Problem solved :

need to be like this in 1 line

PHP Code:
<textarea name="body" cols="40" rows="8"><?php if (isset($_POST['body'])) { echo htmlentities($_POST['body']); } ?></textarea>

and i was make it in 3 line like this to see code better

PHP Code:
<textarea name="body" cols="40" rows="8">
<?php if (isset($_POST['body'])) { echo htmlentities($_POST['body']); } ?>
</textarea>
mlukac89 is offline  
Reply


Similar Threads Similar Threads
Simple website using Html v1
09/07/2013 - SRO PServer Guides & Releases - 43 Replies
Hello,today I remembered that I made html at school so I decided to make a simple,noob website for you. Contains simple editable codes,pure html Archive contains Website.rar and Neededthings.rar You have to secure and publish on internet by yourself(free domain ,for example .tk ) There are two workable functions yet : -Register
HELP simple html i just totally forgot lmao been a while
03/15/2013 - Web Development - 12 Replies
i have a website 5mutny Computer Support its not done at all, i want to change the search box and make it work... but when someone searches i want it to ONLY search MY SITE not Google or any other sites please help me here is the html i have. how can i make that without changing the look or adding radio buttons and make it search only my site? <div id="search_box"> <form action="#" method="post"> <input type="text" value="Search on this website" name="q" size="10" id="searchfield"...
[Design]a simple Register.html page
01/10/2013 - SRO Private Server - 2 Replies
a simple page that anyone can do it but this is my first project i know that with training you would be professional but i don't mean like ... iam kraal no one better than me , no just wanna share it with ya guys Screenshot http://easycaptures.com/fs/uploaded/510/436196975 8.png i hope it likes you



All times are GMT +1. The time now is 10:43.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.