Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 23:45

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

 

Weird simple html and PHP problem

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2010
Posts: 463
Received Thanks: 97
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   #2
 
elite*gold: 58
Join Date: Oct 2012
Posts: 1,155
Received Thanks: 125
Try this:
PHP Code:
<li><textarea name="body" cols="40" rows="8">
<?php echo htmlentities(@$_POST['body']); ?>
</textarea></li>


adistoe is offline  
Old   #3
 
elite*gold: 0
Join Date: Sep 2010
Posts: 463
Received Thanks: 97
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



« Previous Thread | Next Thread »

Similar Threads
Simple website using Html v1
Hello,today I remembered that I made html at school so I decided to make a simple,noob website for you. Contains simple editable...
43 Replies - SRO PServer Guides & Releases
HELP simple html i just totally forgot lmao been a while
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...
12 Replies - Web Development
[Design]a simple Register.html page
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...
2 Replies - SRO PServer - Discussions / Questions



All times are GMT +1. The time now is 23:45.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2017 elitepvpers All Rights Reserved.