Re: Parse error when using Javascript & php?
| From: | Steve | Date: | Sat, 30 Mar 2002 16:17:27 +0000 |
| Subject: | Re: Parse error when using Javascript & php? | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12849@lists.php.net to get a copy of this message | ||
Try making a seperate page to display inside the Iframe and put your
News variable on that page.....also make sure you are testing on either
Netscape 6 or IE 4, 5, or 6 :)
Todd Williamsen wrote:
>
> DOH!! Thanks ross
>
> Umm... Now I cannot get the value of $news to display in the IFRAME... I
> used value="<? Echo "$news"; ?>, that didn't work
>
> Then I put
>
> <? Echo "$news"; ?> between the <iframe> tags, that didn't work
> either
>
> Any suggestions?
>
> -----Original Message-----
> From: Ross Fleming [mailto:r.fleming@totalise.co.uk]
> Sent: Friday, March 29, 2002 1:05 PM
> To: Todd WIlliamsen; php-windows@lists.php.net
> Subject: RE: [PHP-WIN] Parse error when using Javascript & php?
>
> while ($row = mysql_fetch_array($result)) {
> $id = $row['id'];
> $news = $row['news'];
> echo "$news";
> ?>
>
> Spot the missing closing brace }
>
> -----Original Message-----
> From: Todd WIlliamsen [mailto:todd@williamsen.net]
> Sent: 29 March 2002 18:31
> To: php-windows@lists.php.net
> Subject: [PHP-WIN] Parse error when using Javascript & php?
>
> Parse error line 117... there is no line 117..hehe!! I am thinking that
> PHP
> doesn't like IFrames, or Javascript, or maybe just me?
>
> Here is the code:
>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1">
>
> </head>
> <STYLE>
> BODY {margin: 0pt; padding: 0pt; border: none}
> IFRAME {width: 100%; height: 100%; border: none}
> </STYLE>
> <SCRIPT>
> // Default format is WYSIWYG HTML
> var format="HTML"
>
> // Set the focus to the editor
> function setFocus() {
> textEdit.focus()
> }
>
> // Execute a command against the editor
> // At minimum one argument is required. Some commands
> // require a second optional argument:
> // eg., ("formatblock","<H1>") to make an H1
>
> function execCommand(command) {
> textEdit.focus()
> if (format=="HTML") {
> var edit = textEdit.document.selection.createRange()
> if (arguments[1]==null)
> edit.execCommand(command)
> else
> edit.execCommand(command,false, arguments[1])
> edit.select()
> textEdit.focus()
> }
> }
>
> // Selects all the text in the editor
> function selectAllText(){
>
> var edit = textEdit.document;
>
> edit.execCommand('SelectAll');
> textEdit.focus();
>
> }
>
> function newDocument() {
> textEdit.document.open()
> textEdit.document.write("")
> textEdit.document.close()
> textEdit.focus()
> }
>
> function loadDoc(htmlString) {
> textEdit.document.open()
> textEdit.document.write(htmlString)
> textEdit.document.close()
> }
> // Initialize the editor with an empty document
> function initEditor() {
> var htmlString = parent.document.all.EditorValue.value;
> textEdit.document.designMode="On"
> textEdit.document.open()
> textEdit.document.write(htmlString)
> textEdit.document.close()
> textEdit.focus()
> }
>
> // Swap between WYSIWYG mode and raw HTML mode
> function swapModes() {
> if (format=="HTML") {
> textEdit.document.body.innerText = textEdit.document.body.innerHTML
> textEdit.document.body.style.fontFamily = "monospace"
> textEdit.document.body.style.fontSize = "10pt"
> format="Text"
> }
> else {
> textEdit.document.body.innerHTML = textEdit.document.body.innerText
> textEdit.document.body.style.fontFamily = ""
> textEdit.document.body.style.fontSize =""
> format="HTML"
> }
> // textEdit.focus()
> var s = textEdit.document.body.createTextRange()
> s.collapse(false)
> s.select()
> }
>
> window.onload = initEditor
>
> </SCRIPT>
> <!-- Turn off the outer body scrollbars. The IFRAME editbox will display
> its
> own scrollbars when necessary -->
> <BODY SCROLL=No>
>
> <IFRAME ID=textEdit>
> <?
> include "variables.php";
> $connection = @mysql_connect("$dbserver", "$dbuser", "$dbpass")
> or
> die("Couldn't connect to database");
> $db = @mysql_select_db($dbname, $connection) or die("Could not select
> datababse");
> $sql = "SELECT id, news FROM $editortable ORDER BY id";
> $result = @mysql_query($sql,$connection) or die("Could not execute
> query");
> while ($row = mysql_fetch_array($result)) {
> $id = $row['id'];
> $news = $row['news'];
> echo "$news";
> ?>
> </IFRAME>
> <script>
> textEdit.focus();
> </script>
>
> </body>
> </html>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php