Estoy trabajando en una pagina que al ingresar un codigo me muestra los datos del mismo es decir la descripcion y el arancel.
La pagina es Index.php
Código HTML:
 <head> <style type="text/css"> legend { font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; } .titulo{ width:80%; } .contenido{ width:20%; } </style> </head> <script type="text/javascript" src="funciones.js"></script> <body style="background:#FFFFFF;"> <table width="1105" border="1"> <tr> <td height="83"><form name="frmbusqueda" action="" onsubmit="buscarDato(); return false"> <div align="left"> <table width="751" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="124">Codigo <input name="dato" type="text" size="20" maxlength="10" /></td> <td width="627"> <div id="resultado"></div></td> </tr> </table> <label for="textfield"></label> <label for="textfield"></label> </div> </form></td> </tr> </table> </body> </html>
Código PHP:
   <?php
require('conexion.php');
 
$busqueda=$_POST['busqueda'];
// DEBO PREPARAR LOS TEXTOS QUE VOY A BUSCAR si la cadena existe
if ($busqueda<>''){
    //CUENTA EL NUMERO DE PALABRAS
    //$trozos=explode(" ",$busqueda);
    //$numero=count($trozos);
    //if ($numero==1) {
        //SI SOLO HAY UNA PALABRA DE BUSQUEDA SE ESTABLECE UNA INSTRUCION CON LIKE
//        $cadbusca="SELECT * FROM nomhospital WHERE codigo LIKE '%$busqueda%' OR TITULO LIKE '%$busqueda%' LIMIT 10;";
        $cadbusca="SELECT * FROM nomhospital WHERE Codigo = $busqueda ";
    //} elseif ($numero>1) {
        //SI HAY UNA FRASE SE UTILIZA EL ALGORTIMO DE BUSQUEDA AVANZADO DE MATCH AGAINST
        //busqueda de frases con mas de una palabra y un algoritmo especializado
        //$cadbusca="SELECT * , MATCH ( descripcion, fecha ) AGAINST ( '$busqueda' ) AS Score FROM post WHERE MATCH ( TITULO, CONTENIDO ) AGAINST ( '$busqueda' ) ORDER BY Score DESC LIMIT 50;";
    }
    
?>
    <table border="0" cellpadding="0" cellspacing="0" style="width:100%;" > 
 
        <tr>
            <td width="93%" class="titulo">Descripción de la Prestación </td>
            <td width="7%" class="contenido">Arancel</td>
        </tr>
<?php
    $result=mysql_query($cadbusca, $con);
    $i=1;
    while ($row = mysql_fetch_array($result)){
        echo "
            <tr>
                <td class=\"titulo\">".$row['descripcion']."</td>
                <td class=\"contenido\">".$row['arancel']."</td>
            </tr>";
        //echo "<input type='text' name='ver' value=".$row['descripcion']." size='100' maxlength='100'/>";
        $i++;
    }
//}
?>
 
</table>   
Código:
  
Lo que necesito es tomar el valor del arancel para luego en otro textbox ingresar la cantidad y asi multiplicando estos dos me de un resultado final.// JavaScript Document
function nuevoAjax(){
	var xmlhttp=false;
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}
function buscarDato(){
	resul = document.getElementById('resultado');
	
	bus=document.frmbusqueda.dato.value;
	
	ajax=nuevoAjax();
	ajax.open("POST", "prueba.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			resul.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("busqueda="+bus)
}
Espero me puedan ayudar.
Saludos. Y FELIZ 2010!!!!

 
 

