I'm sorry -- what I meant was that the resulting link links to that.
The browser inserts "http://localhost"; to the beginning of the link as
if I had built a relative link rather than a specific complete one.  In
other words, the browser for some reason sees the double-quote as
another normal character rather than the opening and closing ends of a
link.

Here's the HTML for the form I use:

<form method="post" action="addnewrant_logic.php">
<span class="text">Title:</span><br>
<input type="text" name="title" size=50>&nbsp;
<input type="radio" name="type" value="r" checked="on"> Random&nbsp;
<input type="radio" name="type" value="c"> Current<br><br>

<span class="text">Text:</span><br>
<textarea name="text" rows=30 cols=65></textarea><br><br>
<input type="submit"> &nbsp; <input type="reset">
</form>

Here's the code to add the rant:

// Connect to the database and select the table we'll be using.
$db_link = mysql_connect("c831806-a", "root", "catls-9") or die ("we
have no connection");
$db      = mysql_select_db("site", $db_link) or die ("we have no
database");

$text  = str_replace("\n", "<br>", $text);
$text  = addslashes($text);

$date = date("m/d/Y");

// Write out everything that we have.
echo "<hr>Date: $date<br>\nTitle: $title<br>\nType:
$type<br>\nText:<br>\n$text<hr>";

$query  = "INSERT INTO rants SET date=\"$date\", category=\"$type\",
title=\"$title\", rtext=\"$text\""; 
$result = mysql_query($query, $db_link);
echo "<br><br><br>Result: $result";

Thanks!

Later...

                                        -Ari

-----Original Message-----
From: Justin Buist [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 17, 2001 8:32 AM
To: Ari M. Roth
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Quotes, double-quotes, and the like.


On Sun, 16 Sep 2001, Ari M. Roth wrote:

> I'm trying to create a web-based interface that will allow me to save 
> essays to a mySQL database for display on a website.  The problem is 
> that it may include HTML in it, so I need to preserve double-quotes in

> their original context.  Right now, they are not encoding correctly 
> for some reason.  An HTML link, for example, to http://www.yahoo.com 
> would come out as this:
>
> http://localhost/"http://www.yahoo.com";
>
> addslashes() accomplished nothing, and I'm at a loss.  Any ideas?

You should probably paste the HTML form and perhaps the PHP code which
does the actual insersts -- it's completely illogical that
"http://localhost/"; would magically appear before a field name.  At
least in my book.

Justin Buist
Trident Technology, Inc.
4700 60th St. SW, Suite 102
Grand Rapids, MI  49512
Ph. 616.554.2700
Fx. 616.554.3331
Mo. 616.291.2612


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to