This is a discussion on How can I return two values to a form? within the PHP Programming forums, part of the Web Development category; Hi all, I need to return two values of an image's name and price. Here the below is my ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all, I need to return two values of an image's name and price. Here the below is my coding...clear me from my coding.... dbselect Code Code: <?php $q=$_GET["q"]; include "con.php"; $sql="SELECT imgname,price FROM product WHERE no = '".$q."'"; $result = mysql_query($sql); $row=mysql_fetch_row($result); $imgpath=$row[0]; echo "<img width='120px' src=$imgpath>"; //Here I need to return the Price field to the parent page mysql_close($dbh); ?> Code: function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("layer1").innerHTML=xmlHttp.responseText //shows image correctly here.
}
} In HTML code the text box's name is txtprice thanking you in advance..
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| Sponsored Links |
| |||
| Hi accer, Thanx for your reply. Try and let me know if u got solution. I'm go thru this in my head for past 4 hrs. ![]()
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| $imgprice = $row[1]; echo "<img width='120px' src=$imgpath>" . "|" . $imgprice; ............... var nResponse = xmlHttp.responseText; nResponse = nResponse.split("|"); document.getElementById("layer1").innerHTML = nResponse[0]; document.forms[0]['txtprice'].value = nResponse[1]; |
| |||
| Hey geek! Tanks a lot!....I tried for this past 2 days.... thnk u very much!
__________________ S.VinothkumaR Behind me is infinite power, Before me is Endless Possibility, Around me is Boundless Opportunity, Why should I fear! |
| |||
| HI, Try this code.. echo "<?xml version='1.0' encoding='iso-8859-1'?> <response> <imgpath>$path</imgpath> <imgprice>$price</imgprice> </response>"; -------------------------- var xml = xmlHttp.responseXML; var root = xml.documentElement; path = root.getElementsByTagName("imgpath")[0]; price = root.getElementsByTagName("imgprice")[0]; Thanks, Ramkumar.B |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Date/time stamp a form field as the form is submitted | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-06-2008 10:16 PM |
| popup date selector return dates to different form fields. | itbarota | HTML, CSS and Javascript Coding Techniques | 3 | 01-08-2008 10:19 PM |
| How can I clear the form field values after the user has submitted the form for clien | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-01-2007 11:39 PM |
| How can I pass a hidden value to a form and submit that form when a text link is clic | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 10-17-2007 08:07 AM |
| How to establish a COM event sink with return values in the .NET Framework by using V | kingmaker | ASP and ASP.NET Programming | 0 | 07-24-2007 12:06 AM |