Jump to content

DigiMartKe

Members
  • Posts

    17
  • Joined

  • Last visited

DigiMartKe's Achievements

Newbie

Newbie (1/5)

0

Reputation

1

Community Answers

  1. How do i install composer on Php? See getcomposer.org/download. What does terminal mean?
  2. I need to integrate my PHP Application to Credit Card and Paypall System. What is the best way of doing this?
  3. I still have a problem further down, I have now changed the code for LoadSymptomDetails.php and it works. <?php require_once('Connections/Connshifa.php'); ?> <?php //$q = 1 ?> <?php $data = array(); { mysql_select_db("shifa",$Connshifa ); //This works $sql1 = mysql_query("SELECT name,description , comments FROM symptoms" ) or die(mysql_error()); while($row1 = mysql_fetch_assoc($sql1)){ $data[] = $row1; } when i change the php code to <?php require_once('Connections/Connshifa.php'); ?> <?php $data = array(); { mysql_select_db("shifa",$Connshifa ); $symptoms_name = $_POST['Symptom']; $sql1 = mysql_query("SELECT name,description , comments FROM symptoms WHERE symptoms.name ='$symptoms_name'") or die(mysql_error()); while($row1 = mysql_fetch_assoc($sql1)){ $data[] = $row1; } } ?> <?php if($data){ ?> <table border="1"> <tr> <td>name</td> <td>description</td> <td>comments</td> </tr> <?php if($data){ foreach($data as $sy){ ?> <tr> <td><?php echo $sy['name']; ?> </td> <td><?php echo $sy['description']; ?> </td> <td><?php echo $sy['comments']; ?> </td> </tr> <?php } } ?> <?php } ?> </table> When i make these changes , it stops working. I get an error Notice: Undefined index: Symptom in C:\xampp\htdocs\sh\server\LoadSymptomDetails.php on line 6 So how can i pass the selected value in the dropbox to the where part of the select statement. Kindly assist
  4. I have the following code for my dropbox; <select name="Symptom" id="Symptomid" onchange="LSC(this.value)"> Its options are; <option value="<?php echo $row_RsSymptom['name']?>"><?php echo $row_RsSymptom['name']?></option> i have the script ; <script> function LSC(str) { if (str == "") { document.getElementById("txtHint").innerHTML = ""; return; } else { 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("txtHint").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET","LoadSymptomDetails.php?q="+str,true); xmlhttp.send(); } } </script> The LoadSymptomDetails.php has the following lines; $sql1 = mysql_query("SELECT name,description , comments FROM symptoms WHERE symptoms.name ='".$q."'") or die(mysql_error()); The q is not being picked. If i remove the where statement it runs and displays the table. Kindly assist. Azhar
  5. one question , the code <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> if the site is down ? How can this be handled?
  6. see also http://www.w3schools.com/php/php_ajax_database.asp
  7. Thanks , sorted <select name="Symptom" id="Symptomid" onchange="LSC(this)> should have been <select name="Symptom" id="Symptomid" onchange="LSC(this.value)">
  8. I have tried to follow your instructions , but have not been able to achieve. Nothing happens on change of dropbox value. I have made the following changes;(maybe based on this you can tell me what i have missed.) dropbox <select name="Symptom" id="Symptomid" onchange="LSC(this)> HTML have added the line <p id="demo"></p> Java script <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> function LSC(option) { // using jquery ajax method for calling the php script $.ajax({ // set this to the url of your php script for calling the LSC function url: 'LoadSymptomDetailsfridaytest.php', // send POST request method: 'POST', // set the Symptom name value to be submitted data: {Symptom: option.value}, // if the result of the ajax request is ok then this function is called success: function(response) { // the variable 'response' will contain the output from your php script // as an example we'll use a javascript alert to show the output of the response $('p#demo').html(response); } }); } </script> and the php LoadSymptomDetailsfridaytest.php (a bit simplified) <?php require_once('Connections/Connshifa.php'); ?> <?php $data = array(); { mysql_select_db("shifa",$Connshifa ); $sql1 = mysql_query("SELECT name,description , comments FROM symptoms ") or die(mysql_error()); while($row1 = mysql_fetch_assoc($sql1)){ $data[] = $row1; } } ?> <?php if($data){ ?> <table border="1"> <tr> <td>name</td> <td>description</td> <td>comments</td> </tr> <?php if($data){ foreach($data as $sy){ ?> <tr> <td><?php echo $sy['name']; ?> </td> <td><?php echo $sy['description']; ?> </td> <td><?php echo $sy['comments']; ?> </td> </tr> <?php } } ?> <?php } ?> </table> Kindly assist.
  9. This is my full code <?php require_once('Connections/Connshifa.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_Connshifa, $Connshifa); $query_RsSymptom = "SELECT * FROM symptoms ORDER BY symptoms.name"; $RsSymptom = mysql_query($query_RsSymptom, $Connshifa) or die(mysql_error()); $row_RsSymptom = mysql_fetch_assoc($RsSymptom); $totalRows_RsSymptom = mysql_num_rows($RsSymptom); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Cure by Symptom</title> <?php // Start the session session_start(); ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="css/coin-slider.css" /> <style type="text/css"> .main .content .content_resize .mainbar .article label { font-weight: bold; } </style> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/cufon-aller.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <script type="text/javascript" src="js/coin-slider.min.js"></script> </head> <body> <div class="main"> <div class="header"> <div class="header_resize"> <div class="slider"> <div id="coin-slider"></div> <div class="clr"></div> </div> <div class="clr"></div> </div> </div> <div class="content"> <div class="content_resize"> <div class="mainbar"> <div class="article"> <h2>Find Your Cure</h2> <p class="infopost"> </p> <div class="clr"></div> <div class="clr"></div> </div> <div class="article"> <h2>Every Disease has a Cure</h2> <?php echo "Welcome " . $_SESSION["username"] . " !" . ".<br>"; ?> <form id="form1" name="form1" method="post" action=""> <label for="Uname">User Name/Email </label> <input name="Uname" type="text" id="Uname" value="<?php echo $_SESSION["username"] ?>" readonly="readonly" /> <form method="post"> </form> <label for="Symptom"><br /> Select your Symptom <br /> <br /> Symptom</label> <select name="Symptom" id="Symptomid" onchange="LSC()"> <?php do { ?> <option value="<?php echo $row_RsSymptom['name']?>"><?php echo $row_RsSymptom['name']?></option> <?php } while ($row_RsSymptom = mysql_fetch_assoc($RsSymptom)); $rows = mysql_num_rows($RsSymptom); if($rows > 0) { mysql_data_seek($RsSymptom, 0); $row_RsSymptom = mysql_fetch_assoc($RsSymptom); } ?> <br /> <br /> <br /> <br /> <br /> <p id="demo"></p> <script> function Symselect() { var x = document.getElementById("Symptomid").value; document.getElementById("demo").innerHTML = "You selected: " + x; } </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> function LSC() { // using jquery ajax method for calling the php script $.ajax({ // set this to the url of your php script for calling the LSC function url: 'LoadSymptomDetails.php', // if the result of the ajax request is ok then this function is called success: function(response) { // the variable 'response' will contain the output from your php script // as an example we'll use a javascript alert to show the output of the response alert(response); } }); } </script> <?php //require("classes\LoadSymptomDetails.php"); ?> <br /> System</label> </form> <select name="System" id="System"> </select> <p class="infopost"> </p> <p class="infopost"> </p> </div> </div> </div> </div> <div class="footer"> <div class="footer_resize"> <div style="clear:both;"></div> </div> </div> </div> <div align=center>This template downloaded form <a href='http://all-free-download.com/free-website-templates/'>free website templates</a></div></body> </html> <?php mysql_free_result($RsSymptom); ?> and what i to call when a symptom is chosen is(as i want the system other columns to be displayed). I need to do this as when the columns are displayed in a table and a system chosen , the cures also shown in a table. So this code is to be used in two places; Although the code i have below is based on a post , i need it to run based on the combobox change. <?php $data = array(); if(isset($_POST['search'])){ $symptoms_name = $_POST['Symptom']; $sql1 = mysql_query("SELECT name,description , comments FROM symptoms WHERE symptoms.name ='$symptoms_name'") or die(mysql_error()); while($row1 = mysql_fetch_assoc($sql1)){ $data[] = $row1; } } ?> <?php if($data){ ?> <table border="1"> <tr> <td>name</td> <td>description</td> <td>comments</td> </tr> <?php if($data){ foreach($data as $sy){ ?> <tr> <td><?php echo $sy['name']; ?> </td> <td><?php echo $sy['description']; ?> </td> <td><?php echo $sy['comments']; ?> </td> </tr> <?php } } ?> </table>
  10. Understood , but now i have another two issues; 1.The echo is not displayed on the form rather as a popup. I have pasted the screen shot. See Error1.pdf 2. My header page had three pictures , one showing after the other , Now all showing at once , some java script is conflicting. Can it be so? Thank you
  11. i have tried running this code. I saved the first part in ajax.html and the second to lsc_script.php But when i run ajax.html, Nothing happens.Blank Page loads. What am i doing wrong?
  12. i have this on my drop box; (Part) <select name="Symptom" id="Symptomid" onchange="LSC()"> Then i have(java script); <script> function LSCJ(){ <?php LSC();?> } </script> Then i have (PHP function) <?php function LSC() { echo "Hello world Changed!"; } ?> when i change my choice in dropbox the code LSC should run How can i achieve this? what am i doing wrong? Please not that i have run a very complex php code . This is just a sample. Any help given will be highly appreciated . Regards Azhar
  13. I have written the following code; <label for="System">Symptom</label> <label for="Symptom"> <select name="Symptom" id="SymptomId" onchange="Symselect()"> <p id="demo"></p> <script> function Symselect() { var x = document.getElementById("Symptomid").value; document.getElementById("demo").innerHTML = "You selected: " + x; } </script> This is not working. When a select an item on the dropbox , it should display the selection. Similar to http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onchange. Kindly assist . Azhar
×
×
  • 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.