JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 7th, 2008, 12:48 PM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
Wrong sort by javascript

hi
i hve this code , this code is sort data to data base , but when i select valuse form list print value of other filed ,,,

but the wrong is :--
when i dislpy data i see on file address , tell , pationtname ,the value "pationtname " why !!!

we must print on address, tell , pationtname value of each



PHP Code:
<select name="FileNO" onChange="change_pationt(this.value);">
            <? 
 
$query="SELECT * FROM pationt";
$result=mysql_query($query) or die("error: " mysql_error());
while(
$row=mysql_fetch_array($result))
{
?>  
<option value="<?php echo $row['PationtName'] . '^' $row['address'] . '^' $row['tell']; ?>"><?php echo $row['PNO'] ; ?></option>   
<?

    
}  
?>
</select>
<input name="PationtName" type="text" id="PationtName"/>

<input name="address" type="text" id="address"/>

<input name="tell" type="text" id="tell"/> 


PHP Code:
function change_doctor(ref) {
  var 
arr ref.split(/^/);
  
document.getElementById('PationtName').value  arr[0]; 
  
document.getElementById('address').value  arr[1];
  
document.getElementById('tell').value  arr[2];


Reply With Quote
  #2  
Old May 7th, 2008, 01:18 PM
lnxgeek lnxgeek is offline
I AM A GOLDEN GOD
Dev Shed God (5000 - 5499 posts)
 
Join Date: Apr 2003
Location: cannot find symbol: method showLocation()
Posts: 5,278 lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level)lnxgeek User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 21 h 17 m 36 sec
Reputation Power: 564
It may be that something is being lost in the interpretation, because I simply cannot understand what you're asking.

You've shown some PHP code that clearly is meant to populate a SELECT dropdown with values from the database, and what must be your JavaScript / DOM function, but the essential part is how these relate and what your expectations are.

Would you please show us the HTML source from this document (not the PHP code, the HTML that the PHP outputs). That may shed some light on the issue.
__________________
BookMooch.com : Give books away. Get books you want.

Reply With Quote
  #3  
Old May 7th, 2008, 02:04 PM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
&#1567;&#1567;

the problem is when i select value from list the javascript print on pationt name the name of it but on data base the PNO print on it pationtname and this is wrong

Reply With Quote
  #4  
Old May 8th, 2008, 02:28 AM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
??

what can do

Reply With Quote
  #5  
Old May 8th, 2008, 04:48 AM
Joseph Taylor's Avatar
Joseph Taylor Joseph Taylor is offline
Text Ninja
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2005
Location: Vancouver, British Columbia, Canada
Posts: 596 Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 1 h 12 m 43 sec
Reputation Power: 107
Send a message via Skype to Joseph Taylor Send a message via XFire to Joseph Taylor
Quote:
Originally Posted by kamsmartx
what can do


You can either learn English or post in a forum where people speak your language.

Sorry if that sounds harsh, but lnxgeek made a request for clarification which you completely ignored. I realize this request came in a language that probably isn't your first, but if you can't understand that simple sentence, how can you hope to understand a detailed analysis of your code? And why should we waste our time writing said analysis?
Comments on this post
GameYin agrees: Me no hablo english

Last edited by Joseph Taylor : May 8th, 2008 at 04:54 AM.

Reply With Quote
  #6  
Old May 8th, 2008, 04:53 AM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
tell me what u need

Reply With Quote
  #7  
Old May 8th, 2008, 04:55 AM
Joseph Taylor's Avatar
Joseph Taylor Joseph Taylor is offline
Text Ninja
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2005
Location: Vancouver, British Columbia, Canada
Posts: 596 Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level)Joseph Taylor User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 1 h 12 m 43 sec
Reputation Power: 107
Send a message via Skype to Joseph Taylor Send a message via XFire to Joseph Taylor
I quote:

Quote:
Originally Posted by lnxgeek
Would you please show us the HTML source from this document (not the PHP code, the HTML that the PHP outputs). That may shed some light on the issue.


We need the HTML source code. Visit the page, press "View Source" and post what you see here.

Reply With Quote
  #8  
Old May 8th, 2008, 05:15 AM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
this is code of INSERT
PHP Code:
<!-- the part of php code that get and set from data bse -->
<?
include(
"../DBAccess.php");
    if(isset(
$_POST["DocName"])){
        if(
$_POST["DocName"]!=""){
            
// Stories
            
mysql_pconnect("localhost","","")or die("لم يتم اتصالك");
            
mysql_select_db("eoc");
$m_sql "SELECT * FROM appointment WHERE Time='"$_POST['Time'] ."'";
$m_query mysql_query($m_sql);

if (!
$m_query) {
echo 
"<script>window.alert('error');</script>";

else{
$m_rows_count mysql_num_rows($m_query);

if (
$m_rows_count 0) {
echo 
"<script>window.alert('اuse another appointment);</script>";

else {
$query="INSERT INTO `appointment` ( `ANO` , `DocNO`,`DocName` ,`Date` ,`Time` ,`FileNO` ,`PationtName`  )VALUES ('', '".$_POST["DocNO"]."', '".$_POST["DocName"]."', '".$_POST["Date"]."', '".$_POST["Time"]."', '".$_POST["FileNO"]."', '".$_POST["PationtName"]."')";
            
mysql_query($query);
            echo 
"<script>window.alert('add ');</script>";
        }
        }
        }
        else
        {
            echo 
"<script>window.alert('fill text');</script>";
    }
    }
?>
<!-- end of php code -->
<!-- start HTML code that include the FORM -->
<!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>
<script language="javascript" type="text/javascript" src="datetimepicker.js">
</script>
<script language="JavaScript">
<!--
function change_doctor(ref) 

     document.getElementById('DocName').value  = ref; 
}
function change_pationt(ref) 

     document.getElementById('PationtName').value  = ref; 
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>:: ::</title>
<style type="text/css">
<!--
.style1 {
    color: #FFFFFF;
    font-weight: bold;
}
.style2 {color: #FFFFFF}
body {
    background-image: url(../images/black.JPG);
}
.style3 {font-family: Tahoma}
-->
</style>
</head>
<body background="../images/0201_01.jpg" dir="rtl">
<table width="745" border="0" dir="rtl" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td>
<form id="form1" name="form1" method="post" action="<? echo $_SERVER["PHP_SELF"]; ?>" >

<table width="745" border="0" align="center" dir="rtl">
  <tr>
    <td colspan="6" background="../images/bg.gif"><div align="center" class="style1 style2 style3">add new/div></td>
    </tr>
    <tr><td height="20"></td>
    <td></td>
    <td><?php 
    
if(isset($_POST["Submit"])){
        echo 
"$message;";
    }
    
?><td>
        <td></td>
        <td></td>
    <td></td>
    </tr>
  <tr>
    <td width="16%" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style1">
      <div align="center">emp no </div>
    </div></td>
    <td width="1%"><div align="center" class="style2"><strong>:</strong></div></td>
          <td><select name="DocNO" onChange="change_doctor(this.value);" style="background:#CCCCFF">
            <? 
$query
="SELECT * FROM employee";
$result=mysql_query($query) or die("error: " mysql_error());
while(
$row=mysql_fetch_array($result))
{
    echo 
"Error";
?>  
<option value="<?php echo $row['EmpName'] ; ?>"><?php echo $row['EMP'] ; ?></option>   
<?
    
}  
?>
          </select></td>
          <td background="../images/bg.JPG"><div align="center" class="style2 style2"><strong>emp name</strong></div></td>
          <td><span class="style2">:</span></td>
          <td><label>
            <input name="DocName" type="text" id="DocName" style="background:#CCCCFF"/>
          </label></td>           
  </tr>
  <tr>
    <td background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style1">
      <div align="center">date</div>
    </div></td>
    <td><div align="center" class="style2"><strong>:</strong></div></td>
    <td><input id="Date" name="Date" type="text" size="25" style="background:#CCCCFF">
        <a href="javascript:NewCal('Date','ddmmyyyy')"><img src="../images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a></td>
    <td background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style1 style2">
      <div align="center">time</div>
    </div></td>
    <td><span class="style2">:</span></td>
    <td><label>
      <input type="text" name="Time" style="background:#CCCCFF"/>
    </label></td>
  </tr>
  <tr>
    <td background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style1">
      <div align="center">fileno  </div>
    </div></td>
    <td><div align="center" class="style2"><strong>:</strong></div></td>
    <td><label>
    <select name="FileNO" onChange="change_pationt(this.value);" style="background:#CCCCFF">
            <? 
$query
="SELECT * FROM pationt";
$result=mysql_query($query) or die("error: " mysql_error());
while(
$row=mysql_fetch_array($result))
{
    echo 
"Error";
?>  
<option value="<?php echo $row['Name'] ; ?>"><?php echo $row['FileNo'] ; ?></option>   
<?
    
}  
?>
          </select></label></td>
    <td background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style1 style2">
      <div align="center">pationt name </div>
    </div></td>
    <td><span class="style2">:</span></td>
    <td>
        <input name="PationtName" type="text" id="PationtName" style="background:#CCCCFF"/> </td>
  </tr>
  <tr>
    <td colspan="6"></td>
    </tr>
  <tr>
    <td colspan="6"><div align="center"></div></td>
  </tr>
  <tr>
    <td colspan="6">
      <div align="center">
        <input type="submit" name="Submit" value=".:ok:." />
        <input type="button" name="back" value=".:back:." src="appointment.php" />
      </div></td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html> 


and the code of display is :-
PHP Code:
<?
include("../DBAccess.php");
$tbl_name="appointment"// Table name
$query="select * from $tbl_name";
$result=mysql_query($query);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<title>::  ::</title>
<style type="text/css">
<!--
.style2 {
    color: #FFFFFF;
    font-weight: bold;
}
body {
    background-image: url(../images/black.JPG);
}
.style4 {font-family: Tahoma}
-->
</style></head>

<body dir="rtl" background="../images/0201_01.jpg">
<table width="745" border="0" align="center" >
  <tr>
    <td background="../images/bg.gif"><div align="center" class="style2">
      <p class="style4">display </p>
      </div></td>
  </tr>
  <tr>
    <td>
    <table width="745" border="1" bordercolor="#666666">
      <tr>
        <td width="245" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style2">doc name  </div></td>
        <td width="179" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style2">date</div></td>
        <td width="147" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style2">time</div></td>
       <!-- <td width="103" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style2">file no  </div></td>-->
        <td width="140" background="../images/bg.JPG" bgcolor="#0066FF"><div align="center" class="style2"> name of pationt</div></td>
      </tr>
      <? 
              $i
=0;
              while(
$row=mysql_fetch_array($result)){
            
$i++;                        
      
?>
      <tr>
        <td bgcolor="#99CCFF" ><div align="center"><em><strong><?php echo $row["DocName"]; ?></strong></em></div></td>
        <td bgcolor="#CCCCFF" ><div align="center"><em><strong><?php echo $row["Date"]; ?></strong></em></div></td>
        <td bgcolor="#99CCFF" ><div align="center"><em><strong><?php echo $row["Time"]; ?></strong></em></div></td>
        <!-- <td bgcolor="#CCCCFF" ><div align="center"><em><strong><?php echo $row["FileNo"]; ?></strong></em></div></td>-->
        <td bgcolor="#99CCFF" ><div align="center"><em><strong><?php echo $row["PationtName"]; ?></strong></em></div></td>
      </tr>
      <? 
              
}
      
?>
    </table></td>
  </tr>
  
</table>
        <div align="center">
          <input type="button" name="back" value=".:back:." src="appointment.php" />
          </div>
        </div>
</body>
</html>

Reply With Quote
  #9  
Old May 8th, 2008, 06:15 AM
GameYin GameYin is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2008
Location: Whiteford, MD
Posts: 348 GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level)GameYin User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 11 h 54 m
Warnings Level: 5
Reputation Power: 60
Send a message via AIM to GameYin
MySpace
Can't you narrow that down a bit?
__________________
Adwords Professional
You can give me

Reply With Quote
  #10  
Old May 8th, 2008, 10:44 AM
kamsmartx kamsmartx is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 45 kamsmartx Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 10 h 50 m 27 sec
Reputation Power: 0
???

Quote:
Originally Posted by GameYin
Can't you na