Current location: Hot Scripts Forums » Programming Languages » PHP » PHP and JavaScript causing a problem of storing the value


PHP and JavaScript causing a problem of storing the value

Reply
  #1 (permalink)  
Old 07-22-05, 01:36 AM
phplearner phplearner is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
PHP and JavaScript causing a problem of storing the value

This is the javascript

<SCRIPT language=JavaScript>
function reload(form)
{
var val=form.AircraftType.options[form.AircraftType.options.selectedIndex].value;
self.location='edit_report.php?AircraftType=' + val ;
}
</script>

i tried inserting PHP codes into the script but messed up. The drop downs are nt working any more. and the value of my $_GET['ReportID'] changes everytime i click on the drop down. like :

edit_report.php?ReportID=2?AircraftType=19

when i click on the drop down again,

edit_report.php?ReportID=2?AircraftType=19?Aircraf tType=11

and so on...

function reload(form)
{
var val=form.AircraftType.options[form.AircraftType.options.selectedIndex].value;
self.location='edit_report.php?ReportID=<? echo $_GET['ReportID']; ?>?AircraftType=' + val ;
}

how can i reload the page and keep my values at the same time... i manage to bring my report id over but when i used the javascript for drop downs, it reloads the page and everything is messed up...
Reply With Quote
  #2 (permalink)  
Old 07-22-05, 06:01 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
you can only have 1 ? and then the rest are & symbols, e.g:

edit_report.php?ReportID=2&AircraftType=19&AircraftType=11
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #3 (permalink)  
Old 07-23-05, 11:41 AM
phplearner phplearner is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
ya thx i got ur msg and edited my javascript. now there arent any problems but my javascript cant work anymore. the dropdowns cant work. i m sure i m quite closed to solving the problem i really cant think of anything... =(

function reload(form)
{
var val=form.AircraftType.options[form.AircraftType.options.selectedIndex].value;
self.location='edit_report.php?ReportID=<? echo $_GET['ReportID']; ?> + '&AircraftType=' + val ;
}
</script>
Reply With Quote
  #4 (permalink)  
Old 07-23-05, 11:53 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
self.location='edit_report.php?ReportID=<? echo $_GET['ReportID']; ?>&AircraftType=' + val ;

and if u have the parameter val then your gonna have to change function reload(form) to include val
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #5 (permalink)  
Old 07-23-05, 11:15 PM
phplearner phplearner is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
cheers to FiRe! u sovled my problem =) thx alot. i was stucked here for quite sometime now
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Javascript Variable to PHP watadude PHP 4 01-15-11 06:44 PM
JavaScript with PHP phplearner PHP 2 07-16-05 11:46 AM
Include PHP via javascript bkbenson JavaScript 4 02-19-05 12:40 AM
javascript multiple select menu for php? isaacmlee JavaScript 1 10-15-04 09:53 AM
Javascript vs PHP, problem with arrays Chuff JavaScript 0 10-03-03 04:01 AM


All times are GMT -5. The time now is 06:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.