Jump to content

faisalmukhtarch

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by faisalmukhtarch

  1. I am using a drop-down box to fetch the result from MySQL and once i select the result from drop-down it will populate my html text-boxes. it was working fine until i added another drop-down. Kindly have a look at the link and let me know. I am new in programming. let me know if you need anymore elaboration. Thank you http://pastebin.com/EJKA9RsK This part is working //This part is working <?php $vbCrLf = chr(13).chr(10); error_reporting(0); // open connection to MySQL server $link = mysqli_connect("localhost", "root", "root", "print") or die ('Unable to connect!'); //create and execute query $query = "SELECT bin, iban, bename, benadd, bcoun, bcode, bname, badd FROM datee"; $result = mysqli_query($link,$query); //create selection list $DropDownList .= "<select name='Company' id='DropDownListId' onchange='javascript:SelectChanged();'> ".$vbCrLf; $DropDownList .= "<option value=''></option> ".$vbCrLf; while($row = mysqli_fetch_row($result)) { $heading = $row[0]; $DropDownList .= "<option value='$heading'>$heading</option> ".$vbCrLf; $IbnArrayPhp .= 'IbnArray["'.$heading.'"]="'.$row[1].'";'.$vbCrLf; $BenameArrayPhp .= 'BenameArray["'.$heading.'"]="'.$row[2].'";'.$vbCrLf; $BenaddArrayPhp .= 'BenaddArray["'.$heading.'"]="'.$row[3].'";'.$vbCrLf; $BcounArrayPhp .= 'BcounArray["'.$heading.'"]="'.$row[4].'";'.$vbCrLf; $BcodeArrayPhp .= 'BcodeArray["'.$heading.'"]="'.$row[5].'";'.$vbCrLf; $BnameArrayPhp .= 'BnameArray["'.$heading.'"]="'.$row[6].'";'.$vbCrLf; $BaddArrayPhp .= 'BaddArray["'.$heading.'"]="'.$row[7].'";'.$vbCrLf; } $DropDownList .= "</select> ".$vbCrLf; ?> <script language="Javascript" type="text/javascript"> var IbnArray = new Array(); <?php echo $IbnArrayPhp; ?> var BenameArray = new Array(); <?php echo $BenameArrayPhp; ?> var BenaddArray = new Array(); <?php echo $BenaddArrayPhp; ?> var BcounArray = new Array(); <?php echo $BcounArrayPhp; ?> var BcodeArray = new Array(); <?php echo $BcodeArrayPhp; ?> var BnameArray = new Array(); <?php echo $BnameArrayPhp; ?> var BaddArray = new Array(); <?php echo $BaddArrayPhp; ?> function SelectChanged() { var Company = document.getElementById('DropDownListId').value; document.getElementById('iban').value = IbnArray[Company]; document.getElementById('bename').value = BenameArray[Company]; document.getElementById('benadd').value = BenaddArray[Company]; document.getElementById('bcoun').value = BcounArray[Company]; document.getElementById('bcode').value = BcodeArray[Company]; document.getElementById('bname').value = BnameArray[Company]; document.getElementById('badd').value = BaddArray[Company]; } </script> <?php echo $DropDownList; ?> </label> </legend> This part is not working //This part is not working <?php $vbCrLf1 = chr(13).chr(10); error_reporting(0); // open connection to MySQL server $link1 = mysqli_connect("localhost", "root", "root", "print") or die ('Unable to connect!'); //create and execute query $query1 = "SELECT aini, acname, acnum, num2, num3 FROM datee"; $result1 = mysqli_query($link1,$query1); //create selection list $DropDownList1 .= "<select name='Company1' id='DropDownList1Id' onchange='javascript:SelectChanged();'> ".$vbCrLf1; $DropDownList1 .= "<option value=''></option> ".$vbCrLf1; while($row1 = mysqli_fetch_row($result1)) { $heading1 = $row1[0]; $DropDownList1 .= "<option value='$heading1'>$heading1</option> ".$vbCrLf1; $AcnameArrayPhp .= 'AcnameArray["'.$heading1.'"]="'.$row1[1].'";'.$vbCrLf1; $AcnumArrayPhp .= 'AcnumArray["'.$heading1.'"]="'.$row1[2].'";'.$vbCrLf1; $Num2ArrayPhp .= 'Num2Array["'.$heading1.'"]="'.$row1[3].'";'.$vbCrLf1; $Num3ArrayPhp .= 'Num3Array["'.$heading1.'"]="'.$row1[4].'";'.$vbCrLf1; } $DropDownList1 .= "</select> ".$vbCrLf1; ?> <script language="Javascript" type="text/javascript"> var AcnameArray = new Array(); <?php echo $AcnameArrayPhp; ?> var AcnumArray = new Array(); <?php echo $AcnumArrayPhp; ?> var Num2Array = new Array(); <?php echo $Num2ArrayPhp; ?> var Num3Array = new Array(); <?php echo $Num3ArrayPhp; ?> function SelectChanged() { var Company1 = document.getElementById('DropDownList1Id').value; document.getElementById('acname').value = AcnameArray[Company1]; document.getElementById('acnum').value = AcnumArray[Company1]; document.getElementById('num2').value = Num2Array[Company1]; document.getElementById('num3').value = Num3Array[Company1]; } </script> <?php echo $DropDownList1; ?> </label> </legend>
  2. Below are the screenshot of the problem i am having. I also have attached the the screenshot of the code where it is refereeing to. I am new to PHP, might be missing the basic things. I have tried on XAMPP and WAMPP. but same problem.
  3. Hi guys, I am new to PHP I have a Friends website, which was working perfectly on his PC. When i tried to run it. i am getting the following error. connect_db(); //================================================================================ if(isset($_POST['submit'])=="login"){ $where="( email='".mysql_real_escape_string($_POST["email"])."') and ( password='".mysql_real_escape_string($_POST["password"])."')"; $seldata=$nds->webdreamselect('tbl_users',$where,'','','',''); echo mysql_error(); if(mysql_num_rows($seldata)!=0){ $customer_details=mysql_fetch_array($seldata); echo mysql_error(); $_SESSION["member_id"]=$customer_details["id"]; header("location: home.php"); }else{ $message="Invalid Username / Password Please try again."; } } //================ ?> The database file has sql extension. I used that file in PHPMYADMIN to to import the tables, and it went successful But i am getting this error. Kindly help me out. If anyother information needed, let me know. Apologize if i did not follow the proper rules. Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.