GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Nov-2007, 14:41
blueice blueice is offline
New Member
 
Join Date: Nov 2007
Posts: 3
blueice is on a distinguished road

PHP + MySQL + Javascript


i am trying to create a dropdown menu that lists previously saved entries onto an orderform, when they click the option, the data gets entered for them. i am just having some problems on getting this done.

PHP Code:

function execute()        {                $puinfo = $this->db->query("SELECT setname FROM %porder_pickupinfo WHERE user_id=%d", $this->user['user_id']);                $pickupinfoset = $this->db->query("SELECT setname FROM %porder_pickupinfo WHERE user_id=%d", $this->user['user_id']);                $pickupsetoptions = "<option value=\"0\" selected>Saved Pickups</option>";                while ( $row = $this->db->nqfetch($pickupinfoset) )                {                    $count++;                    $pickupsetoptions .= "<option value=\"$count\">{$row['setname']}</option>";                }                return eval($this->template('MAIN_ORDERFORM'));        } 



Code:
function setPickupInfo() { var box = document.getElementById("PickUpSets"); var num = box.selectedIndex; var field = document.getElementById("PickUpCompany"); if ( num == 0 ) field.value = ""; else { if ( $count == 1 ) { field.value = $puinfo['company']; // Line 107 } else { field.value = $puinfo[num]['company']; } } }

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/virtual/site490/fst/var/www/html/func/orderform.php(54) : eval()'d code on line 107

i've tested the script to make sure it edits the input box correctly, so that works fine, its just when i try to reference the php from the javascript that i am messing up, any help would be appreciated.
  #2  
Old 02-Nov-2007, 19:22
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 952
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: php + mysql + javascript


In the PHP code, what is the intent of "%p" after the FROM keyword ?
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 02-Nov-2007, 20:33
blueice blueice is offline
New Member
 
Join Date: Nov 2007
Posts: 3
blueice is on a distinguished road

Re: php + mysql + javascript


sorry that the first php box looks wierd,
PHP Code:

function execute()
        {
                $puinfo = $this->db->query("SELECT setname FROM %porder_pickupinfo WHERE user_id=%d", $this->user['user_id']);
                $pickupinfoset = $this->db->query("SELECT setname FROM %porder_pickupinfo WHERE user_id=%d", $this->user['user_id']);
                $pickupsetoptions = "<option value=\"0\" selected>Saved Pickups</option>";

        $count = 0;
                while ( $row = $this->db->nqfetch($pickupinfoset) )                
        {
                    $count++;
                    $pickupsetoptions .= "<option value=\"$count\">{$row['setname']}</option>";
                }
                return eval($this->template('MAIN_ORDERFORM'));
        } 



the %p is replaced with the prefix for the database tables
  #4  
Old 05-Nov-2007, 19:48
TurboPT's Avatar
TurboPT TurboPT is offline
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 952
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: php + mysql + javascript


I think you might need some script tags wrapped around the Javascript code -- it needs to be handled a little differently when mixed with PHP. Have a look at this.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 11-Nov-2007, 17:04
blueice blueice is offline
New Member
 
Join Date: Nov 2007
Posts: 3
blueice is on a distinguished road

Re: PHP + MySQL + Javascript


i figured out a way to achieve my goal without passing variables through, thanks anyways guys
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cpanel downgrade MYSQL 4.1.X to MySQL 4.0.xx Webhosting-live Web Hosting Forum 1 01-Sep-2006 02:54
php and mysql vladimy MySQL / PHP Forum 2 28-May-2005 05:17
An Introduction to Javascript JasonMichael Web Design Forum 2 24-Oct-2004 10:19
JavaScript Tutorial Part 1 pcxgamer Web Design Forum 2 01-Dec-2003 09:16
Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More EyotaHosts Web Hosting Advertisements & Offers 0 28-Jun-2003 13:54

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 05:33.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.