Jump to content

how to make this


kamsmartx

Recommended Posts

Welcome

Question

I want to change the value of text field when choosing from a list value of the solution

Be interpreted as follows

I'm in a field next to the texts and also list and is required when selecting the value of the list and let 1 box sent to neighbouring value figure 1 in the database and let Name

Link to comment
https://forums.phpfreaks.com/topic/102855-how-to-make-this/
Share on other sites

kamsmartx I don't quite follow what you are asking here.

 

If you have a JavaScript object, lets cal it obj.

 

// this changes the value of the object
obj.value = 'a new value';

 

You can also but the above code into some sort of function and add an event listener to your list. Something like this:

 

<input id="list" onchange="yourFunction();" />

 

Hopefully this helps, if not, please try and re-ask your question. Or maybe someone else gets it :P

Link to comment
https://forums.phpfreaks.com/topic/102855-how-to-make-this/#findComment-526874
Share on other sites

take this code

<select name="FileNo" id="select2" onChange="change_title();">
<? 
$query="SELECT * FROM pationts";
$result=mysql_query($query) or die("error: " . mysql_error());
while($row=mysql_fetch_array($result))
{
echo "bla";
?>  
<option value="<?php echo $row['FileNo'] ; ?>"><?php echo $row['FileNo'] ; ?></option>   
<?

}  
?>
</select>

 

the above code is for list i need to select value from it and when i select value we must change vale on the below code

<input name="PationtName" type="text" id="title"/>

Link to comment
https://forums.phpfreaks.com/topic/102855-how-to-make-this/#findComment-526881
Share on other sites

<?
$con=mysql_connect("localhost","root","");
mysql_select_db("dbname",$con);
?><html>
<head>
<script type="text/javascript">
function chang()
{

}
var xmlHttp

function showCustomer(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="chan.php";
url=url+"?id="+str;
alert(url);
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ //alert(xmlHttp.responseText);
document.myForm.patname.value=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
</script>
</head><body>
<form name="myForm">
<select  onChange="showCustomer(this.value)"name="FileNo" id="select2" onChange="change_title();">
<? 
$query="SELECT * FROM table";
$result=mysql_query($query) or die("error: " . mysql_error());
while($row=mysql_fetch_array($result))
{

?>  
<option value="<?php echo $row['field'] ; ?>"><?php echo $row['field'] ; ?></option>   
<?

}
?>

<input type="text" name="patname" />

</form>

<!--<div id="Hint"></div>-->

</select>




 

 

chan.php

 


<?
$con=mysql_connect("localhost","root","");
mysql_select_db("dbname",$con);
$id=$_GET["id"];

$sql=mysql_query("select * from table where fieldname='$id'");
while($rows=mysql_fetch_array($sql))
{
echo $rows["fieldname"];
}
?>

Link to comment
https://forums.phpfreaks.com/topic/102855-how-to-make-this/#findComment-526919
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.