JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 23rd, 2002, 03:23 AM
hccfilms hccfilms is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 31 hccfilms User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
PHP with javascript inside doesn't work...PLEASE HELP

I have a php script with a javascript inside. But nomather what i do, I get errors...

Se the attached file
Attached Files
File Type: php shop_checkout.php (11.7 KB, 551 views)

Reply With Quote
  #2  
Old February 23rd, 2002, 05:07 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,534 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 15
Send a message via Yahoo to jdk
You get error in PHP or in Javascript ?

Puttin only code up doesnt help. Put up error too.

JD
__________________
_____________________________
d.k.jariwala (JD)
~ simple thought, simple act ~
I blog @ http://jdk.phpkid.org

Reply With Quote
  #3  
Old February 23rd, 2002, 06:14 AM
hccfilms hccfilms is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 31 hccfilms User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Here is the error:

Parse error: parse error in /home/sites/site300/web/shop/shop_checkout.php on line 449

But line 449 does not contain any text at all...

Reply With Quote
  #4  
Old February 23rd, 2002, 06:23 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,534 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 15
Send a message via Yahoo to jdk
Actually you have missed closing of single or double quotes or a semicolon.

In that case, parser gets confused and gives wrong line number.

It is not compulsory that error is on that line only. It may be on that line or previous lines.

As such your code is lengthy and not formatted properly so its hard to debug, you would have"to do it yourself.

JD

Reply With Quote
  #5  
Old February 23rd, 2002, 04:45 PM
Harry Harry is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: Den Haag, Netherlands
Posts: 69 Harry User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
It helps if you don't mix large pieces of HTML and PHP, and definitely not in PHP control structures. For example, line 48-50,

PHP Code:
if ($num_rows == "0") {
    echo 
"<P><strong>There are no items in your cart.</p>";
} else { 


and then follows a lot of HTML. Where does the else block end? No wonder you get confused.

What I usually do, is first arrange all the complicated PHP stuff, then put all the HTML as 'here doc' text, in which you can insert PHP variables. Example:

PHP Code:
<?php
// First all PHP stuff
if( $something )  {
   
$message "Some message";
} else {
   
$message "Another message";
}
// Now the HTML stuff
echo <<<PAGE
<HTML>
...
<p>Message: 
$message</p>
...
</HTML>
PAGE;
?>
__________________
Code:
Groetjes van Harry!   8-)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > PHP with javascript inside doesn't work...PLEASE HELP

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap