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



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 11th, 2011, 03:03 PM
siddhanta siddhanta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2011
Posts: 1 siddhanta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m 14 sec
Reputation Power: 0
Forms: POST & GET - Passing a string value from javascipt to php

hi,
i have two drop down list.
First one is populated from database and its working fine.
Second one will also be populated from database but as per the value selected from the first drop-down list.

Code:
<head>
<script type="text/javascript">
function xyz_list()
{

// xyz_list is the id of my first drop-down list
  var xyz_list=document.getElementById("mob_list");
  brand=xyz_list.options[mob_list.selectedIndex].text;
 if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("xyz").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","XYZ.php?brand=" + brand,true);
xmlhttp.send();
}
</script>
</head>

<body>
<form>
<select id="xyz" onfocus="xyz_list()">
<OPTION VALUE=All>All 
<?php echo $options?> 
</SELECT> 
</form>
</body>


Below is the xyz.php script

PHP Code:
<?php
$brand
=$_GET['brand'];
//alert($brand);

 //below is just inserting a blank value in drop list
 
$options_mobile.="<OPTION VALUE=abc>".$brand.'</option>';
$con mysql_connect('localhost''root''');
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("mobile1"$con);


$sql="SELECT xyz FROM abc where pqr= '$brand'";

$result mysql_query($sql);
$options.="<OPTION VALUE=\"$result\">".$result.'</option>';
while(
$row mysql_fetch_array($result))
  {
 
// $xyz=$row["xyz"]; 
  
$xyz=$row["xyz"];
   
$options.="<OPTION VALUE=\"$xyz\">".$xyz.'</option>';
 }
mysql_close($con);
?>


I am new to both of the languages, but i know wat my code wants to do. i googled a lot to find the error, But i cant figure out where i am wrong.
Help will be highly appreciated.

Thanks

Reply With Quote
  #2  
Old August 27th, 2012, 06:31 AM
ganesan ganesan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 1 ganesan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 50 sec
Reputation Power: 0
PHP Development India

forum posting which is you are giving is really very nice.

Reply With Quote
  #3  
Old August 28th, 2012, 03:35 AM
Frank451 Frank451 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 3 Frank451 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 4 sec
Reputation Power: 0
Have you tried to import the data inside a new database file? If not then try to do it. It could solve your problem.URLURLURL

Reply With Quote
  #4  
Old August 29th, 2012, 02:25 AM
roars1111 roars1111 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2012
Posts: 4 roars1111 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 48 sec
Reputation Power: 0
<?php
$appData
= array();
if(!empty($signedRequest)&&!empty($signedRequest['app_data'])){
$appData
= json_decode($signedRequest['app_data'],true);
}

echo
'<pre>'. print_r($appData).'</pre>';
//prints Array ( [lat] => 123 [lon] => 456 ) when fer.php reloads

$params
= array(
'lat'=>'123',
'lon'=>'456'
);

$encodedParams
= urlencode(json_encode($params));

$tabUrl
==app_433576149993619';
//$tabUrl will open fer.php

$linkUrl
= $tabUrl .'&app_data='. $encodedParams;
?>
...
function loopPage()
{
top.location = "
<?= $linkUrl ?>";
//reloads fer.php
}

Reply With Quote
  #5  
Old November 19th, 2012, 01:19 AM
lugocottewd lugocottewd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 6 lugocottewd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 31 sec
Reputation Power: 0
I know exactly how you can update multiple columns in a row.





Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Forms: POST & GET - Passing a string value from javascipt to php


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 - 2014, Jelsoft Enterprises Ltd.

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