Andrew Chamberlain
Andrew Chamberlain

Reputation: 107

Expanding Character Limit

Has anyone experienced making a compose form for a blog?

I have this problem that works perfectly fine in my localhost but when I try to upload in on the server things are not working out.

My problem is, when I am running at localhost it accepts unlimited number of character and save to database as "text" data type but running it on the site it only accepts 10,000 character, beyond that it return an error. What could be the problem here?

Here's my code.

<form action="savepost.php" method="POST">
<fieldset style="width:600px; height:580px">
<br><strong>Title</strong> <input id="posttitle" name="posttitle" type="text">
<br><br><strong>Content</strong>
<br><textarea id="postform" name="postform" style="width:600px; height:450px; resize: none"></textarea>
<br><input type="submit" value="Post" id="postbutton"/>
</fieldset>
</form>

savepost.php is basically a mysql insert process.

Upvotes: 0

Views: 1107

Answers (3)

Yousuf Memon
Yousuf Memon

Reputation: 4798

1- Make sure that the Datatype in your Database Schema Table is set to TEXT, LONGTEXT or MEDIUMTEXTin both local and hosting server.

TEXT : 65,000 characters
MEDIUMTEXT: 16 million characters
LONGTEXT : 4 trillion

2- In your php.ini set post_max_size to your desired numbers of million characters. Default is (in WAMP) post_max_size = 8M

Upvotes: 1

Kamil
Kamil

Reputation: 1641

try check/set in php.ini or in .htaccess

post_max_size=20M

Upvotes: 1

Dai
Dai

Reputation: 155065

Just change your MySQL database schema to allow more text than 10,000 characters.

According to this document ( http://dev.mysql.com/doc/refman/5.0/en/blob.html ) you should use the LONGTEXT type, which has a limit of 4 gibibytes of text, certainly enough space :)

Upvotes: 0

Related Questions