Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More database headaches = Javascript/mysql 1

Status
Not open for further replies.

LTeeple

Programmer
Aug 21, 2002
362
CA
Hi all,
As promised, here is my other problem. I have the following values stored in a database:
Code:
+----+----------------+-------------------------------------------------+
| ID | PLACE_NAME     | ADDRESS                                         |
+----+----------------+-------------------------------------------------+
|  9 | Laura\'s Place | Party Central <br>123 Easy Street <br>Suite 220 |
+----+----------------+-------------------------------------------------+

My code to output said values is as follows:
Code:
  $address = str_replace("<br>","\n",$address);
  $address_block .= 'document.forms["places_form"].elements["edit_place_address"].value = "'.$address.'";';
Note that 'document.forms["places_form"].elements["edit_place_address"] is a text area (thus the str_replace... I wanted it to look neat in the text area)

My Javascript Error is as follows:
Code:
Error: unterminated string literal
Code:document.forms["places_form"].elements["edit_place_address"].value = "Party Central
//the error pointer is pointing at the double Quotation marks immediately before Party Central

Once again, I greatly appreciate your assistance!

[banghead]

[cheers]
Cheers!
Laura
 
Try this:
Code:
$address = str_replace("<br>","\[COLOR=red]\[/color]n",$address);

I'm not a PHP programmer, but what I'm guessing is that PHP is throwing a carriage return to the browser, so your string is terminating before it's supposed to. \\n should ensure that \n is still left in the string.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
kaht

Thanks once again. It's funny how usually I can catch these things. Guess I'm just a bit scatterbrained today.



[cheers]
Cheers!
Laura
 
No problem, thanks for the stars.

-kaht

...looks like you don't have a job, so why don't you get out there and feed Tina.
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top