shortysbest Posted May 20, 2010 Share Posted May 20, 2010 I have a text area for a lot of text for an about us section on my webpage, when i copy and paste about 5 paragraphs and click save (to update database) it wont save. However if its just a little bit of text it does with no problems, It was working with the large text once. If i copy and paste all of the text into the database directly it outputs it perfectly fine too.. Im not sure what the problem could be. This is the section that takes care of this part of the page. <?php if ($_SESSION['username']) { $dealinfo = strip_tags($_POST['dealinfo']); if ($_POST['update']) { if($dealinfo) { $query2 = mysql_query("UPDATE other SET dealinfo='$dealinfo'"); print "<h3>Saved Successfully!</h3>"; print "<script>"; print "self.location='index.php?node=dealers'"; print "</script>"; } else Print "<h3>You must enter information for new dealers.</h3>"; } $query = mysql_query("SELECT * FROM other"); $row = mysql_fetch_assoc($query); Print "<h5>New Dealer Information</h5>"; Print "<form action='index.php?node=dealers' method='POST'><textarea name='dealinfo' class='ndibox' rows='20'>".$row['dealinfo']."</textarea>"; Print "<input name='update' type='submit' value='Save'></form>"; } else { $query = mysql_query("SELECT * FROM other"); $row = mysql_fetch_assoc($query); Print "<p><h5>New Dealer Information</h5>"; Print "<h1>".$row['dealinfo']."</h1>"; } ?> this is the entire page code: <?php include('../connect.php'); ?> <?php if ($_SESSION['username']) { if (isset($_POST['submit'])) { $storename = ucwords(strip_tags($_POST['storename'])); $name = ucwords(strip_tags($_POST['name'])); $location = ucwords(strip_tags($_POST['location'])); if ($storename&&$name&&$location) { $query6 = mysql_query("INSERT INTO dealers VALUES('','$storename','$name','$location')"); print "<script>"; print "self.location='index.php?node=dealers';"; print "</script>"; } else Print "<h3>You must fill in all fields.</h3>"; } Print '<form action="index.php?node=dealers" method="POST">'; Print '<table class="dealer"width="166" border="0" cellspacing="3" cellpadding="0">'; Print '<tr><td width="166"><h4>Store Name:</h4></td><td><h4>Owner\'s Name:</h4></td><td><h4>Location:</h4></td>'; Print '<tr><td><input name="storename" type="text" maxlength="100"></td><td><input name="name" type="text" maxlength="100"></td><td><input name="location" type="text" maxlength="100"></td><td><input name="submit" type="submit" value="Add Dealer"></td></tr>'; Print '</table>'; Print '</form>'; } ?> <?php $query1 = mysql_query("SELECT * FROM dealers ORDER BY storename "); Print '<h5>Our Dealers</h5>'; Print '<table class="table" cellspacing="0" cellpadding="0">'; Print '<tr><td class="tableheader">Store Name</td><td class="tableheader">Owner\'s Name</td><td class="tableheader">Location</td></tr>'; while ($row = mysql_fetch_array($query1)) { $storename = $row['storename']; $name = $row['name']; $location = $row['location']; Print '<tr><td class="rows">'.$storename.'</td><td class="rows">'.$name.'</td><td class="rows">'.$location.'</td></tr>'; } Print '</table>'; ?> <?php if ($_SESSION['username']) { $dealinfo = strip_tags($_POST['dealinfo']); if ($_POST['update']) { if($dealinfo) { $query2 = mysql_query("UPDATE other SET dealinfo='$dealinfo'"); print "<h3>Saved Successfully!</h3>"; print "<script>"; print "self.location='index.php?node=dealers'"; print "</script>"; } else Print "<h3>You must enter information for new dealers.</h3>"; } $query = mysql_query("SELECT * FROM other"); $row = mysql_fetch_assoc($query); Print "<h5>New Dealer Information</h5>"; Print "<form action='index.php?node=dealers' method='POST'><textarea name='dealinfo' class='ndibox' rows='20'>".$row['dealinfo']."</textarea>"; Print "<input name='update' type='submit' value='Save'></form>"; } else { $query = mysql_query("SELECT * FROM other"); $row = mysql_fetch_assoc($query); Print "<p><h5>New Dealer Information</h5>"; Print "<h1>".$row['dealinfo']."</h1>"; } ?> Link to comment https://forums.phpfreaks.com/topic/202436-updating-information-on-database-copy-and-paste-long-text-wont-update/ Share on other sites More sharing options...
litebearer Posted May 20, 2010 Share Posted May 20, 2010 have you tried echoing the variable before you try to update, just to see the contents? It will help isolate database issue vs for/post/variable issues Link to comment https://forums.phpfreaks.com/topic/202436-updating-information-on-database-copy-and-paste-long-text-wont-update/#findComment-1061404 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.