TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-26-2008, 12:05 PM   #1 (permalink)
The Visitor
Newcomer 
 
sauravlnk's Avatar
 
Join Date: Dec 2008
Posts: 1
Thanks: 0
sauravlnk is on a distinguished road
Confused problem in php

PHP Code:
<?php
session_start
();
if(
$_SESSION['login']=="true")
{
echo 
"<b style=color:red>logged In As ".$_SESSION[username];
?>
<head>
<script language="javascript">
function f1()
{
var a=document.getElementById('b').value;
var b=document.getElementById('c').value;
var c=a*b;
document.getElementById('d').value=c;
}</script></head>
<body background="back1.jpg">
<table align="right"><tr align="right"><th><a href="logout.php" title="click here for logout">LogOut</a></th></tr></table>
<?php
$con
mysql_connect('localhost''root');
if (!
$con) {
   die(
'Could not connect to database server: ' mysql_error());
}
$dbname 'my_db';
$db_selected mysql_select_db($dbname$con);
if (!
$db_selected) {
   die(
"Could not connect $dbname " mysql_error());
}
$res=mysql_query("select p_name,p_price from temp where s_name='$_SESSION[username]'");
echo 
"<b><center>";
echo 
"<p style=color:#FF66CC>";
echo 
"Hi $_SESSION[username] "."Information On Shopping";
echo
"<br>";
echo
"<br>";
//$num_fields = mysql_num_fields($res);
?>
<form action="" method="post" enctype="multipart/form-data" name="frm1">
<table cellspacing="7" cellpadding="8" >
<tr>
<th>product Name</th>
<th>product price</th>
<th>Quantity</th>
<th>Total Price</th>
</tr>
<?php
while($res2=mysql_fetch_object($res))    
//for($x=0;$x<$num_row;$x++)
{
?>
<tr>
<td><input type="text" id="a" name="a" value="<?php echo $res2->p_name?>" readonly=""></td>
<td><input type="text" id="b" name="b" value="<?php echo $res2->p_price?>" readonly=""></td>
<td><input type="text" id="c" name="c" onBlur="javascript:f1()"></td>
<td><input type="text" id="d" name="d" value=""></td>
</tr>
<?php
}
?>
</table>
</form>
<a href="home1.php">Buy More Product</a>
<?php 
}
else
{
echo 
"Unauthorized Visit ! You Cannot access this Page";
echo
"<br>";
echo
"<br>";
echo 
"<a href='index.php' title='go back to login page'>click here to login</a>";
}
?>
I am wirting a programme on shopping cart there i am facing a problem while i am calculating the price of individual product using Javascript Blur Function..It is calculating only one value at a time..
it couldnot calculate the next values of the product which the user buying....pls can anyone help me out....pls send it in my email..its sauravlnp@gmail.com

Last edited by Salathe : 12-26-2008 at 05:35 PM. Reason: Wrapping code in PHP tags
sauravlnk is offline  
Reply With Quote
Old 12-26-2008, 05:05 PM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Please use [php], [highlight=php], or ATLEAST [code] -tags around your code.
__________________
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
PHP Namespace Issue - What do you guys think? Wildhoney The Lounge 7 10-28-2008 02:34 PM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM
Problem with Prototype and PHP wiifanatic Javascript, AJAX, E4X 3 02-18-2008 01:39 AM
Problem with code in PHP file lashawnie Javascript, AJAX, E4X 2 12-06-2007 06:33 AM


All times are GMT. The time now is 04:52 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design