RE: Solved. [PHP] Multiple word strings getting truncated - help please.

From: Date: Sat, 30 Aug 2003 22:42:15 +0000
Subject: RE: Solved. [PHP] Multiple word strings getting truncated - help please.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161277@lists.php.net to get a copy of this message
Hi David, >From your suggestion, I found the problem. I'm validating the form and if something isn't correct, I'm not doing the query, but maintaining what the user previously entered with the following code: <?php if(isset($_POST['addr1'])){$a1 = $_POST['addr1'];}else{$a1 = "";}?> <input type="text" name="addr1" size="32" value="<?php echo $a1; ?>"> In some of the input tags, I hadn't put quotes around the value. Thanks, James -----Original Message----- From: David Otton [mailto:phpmail@jawbone.freeserve.co.uk] Sent: Saturday, August 30, 2003 3:24 PM To: James Johnson Cc: php-general@lists.php.net Subject: Re: [PHP] Multiple word strings getting truncated - help please. On Sat, 30 Aug 2003 14:52:30 -0700, you wrote: >I have a form for a member to signup for an account. The form has >standard fields for addresses, city state, etc. When I insert the data >into the table, if the string has more than one word, it gets truncated >to the first word. > >Does this sound like a PHP or a MySQL problem. > >Here's the code: (partial as the query is quite long) Odd. Try this $tr_addr1 = mysql_escape_string ($_POST['addr1']); $query = "INSERT INTO subscribers (addr1) VALUES('$tr_addr1')"; echo ("$query<br>"); And tell us what you get. Then you at least know whether it's a MySQL problem or an HTML/PHP problem. Hmm. You are quoting your HTML attributes, right? That's the only thing I can think of that even comes close to the behaviour you describe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#161277) next »