> -----Original Message----- > From: Mike Smith [mailto:[EMAIL PROTECTED]] > Sent: 12 December 2002 14:47 > > Rendered results of <a href...> = > > http://company.com/custmaint.php?id=70&class=&cust=company > T/T #29&type=OEM > > id is the record id > class is Null so that's OK. > cust=company T/T #29 > type=OEM > > I present the info in a form... > > echo "<td>\n"; > echo "<input type=\"text\" name=\"cust\" value=\"$cust\">\n"; > echo "</td>\n"; > > This gives me: > +------------------------+ > |company T/T | > +------------------------+ > *Note lack of #29 which I do see in the HTML table. If I save > (UPDATE WHERE > id=$id) this record cust will now be company T/T > > All the other fields fill in correctly. Is it seeing the # as > a comment?
Nope -- as an anchor name. Written like this, you're telling your browser to load the page identified by http://company.com/custmaint.php?id=70&class=&cust=company T/T (which, by the way, is probably invalid in itself, but we'll come to that!), and then go to the anchor named 29&type=OEM on that page. What you need to do is urlencode() the value of the cust parameter before inserting it in your <A href=....> tag, so that any characters which might cause problems (such as # or &, or even space) don't appear in the rendered URL, but instead are encoded as a %xx value (or maybe + for a space -- can't remember which urlencode() does). This is all you need to do -- as it's a URL, it automatically gets URL-decoded by the Web server before being passed to your script, so you should see what you want. (But don't forget to re-urlencode it if you need to pass it on in another URL!) Hope this helps! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php