473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how can we access an HTML variable in the same page?

this is savyatha trying to learn & do a project using HTML, PHP with DATABASE CONNECTIVITY.
iam unable to get the desired output due to the problems iam facing.
they are:
if i write action then the output is getting displayed on a new page.
i want the output of PHP to be displayed on the same page.
also, how can we post variables to a PHP code in the same page?
can we call an action without SUBMIT button?
Mar 6 '07 #1
5 1960
mainul
51
Hi Savyatha
send us the code you have developed so far. otherwise it would be dificult for us to give you the exact solutions.

best regards
Mainul
Mar 6 '07 #2
thanks u mainul sir for responding to my thread .
i want to explain my problem clearly here:
i need to generate a bill online to the customer entered into the shop
first in a select box , i have to get all the categories in the shop. for ex, fruits, vegetables, furniture etc . this shd be retrieved from the database & must be displayed on the select box.
when once a category is selected, all the items in that category must be displayed in another select box.
next , the quantity purchased by the customer must be entered either in a text box or in a select box.
after this, a row of table must be displayed which consists of item id, itemname, price(unit price * quantity).
similarly an ADD option must be provided .
if add is clicked then again we must be able to select another category or the same, item & then the quantity $ finaly the itemid, item name, price corresponding to this item must come as a second row ie., next to the first row
like wise, after selecting & adding all the items bought by the customer row wise like a table format, we need to add all item prices to get the total amount.

sir! hope u have now understood clearly what actually i wants. so, sir, plz reply this v soon
Mar 6 '07 #3
the code i have developed for the implementation of the above task is:
[php]
<form name="f1" action="catitem.php" method='post'>
Category:<select name='s1' onchange="f1.submit();">
<?php
include('adodb.inc.php');
$db=ADONewConnection("postgres");
$db->connect("localhost","rams","","stu");
$q="select distinct ctgry from inv";
echo "<option>$_POST[s1]</option>";
$rs=$db->Execute($q);
while(!$rs->EOF)
{
$c=$rs->fields['ctgry'];
if($c!=$_POST[s1])
echo "<option>";
echo $c;
echo "</option>";
$rs->MoveNext();
}
?>
</select>
Item:<select name='s2'>
<?php
include('adodb.inc.php');
$db=ADONewConnection("postgres");
$db->connect("localhost","rams","","stu");
$q="select * from inv where ctgry='$_POST[s1]'";
$rs=$db->Execute($q);
while(!$rs->EOF)
{
$in=$rs->fields['itemname'];
echo "<option>";
echo $in;
echo "</option>";
$rs->MoveNext();
}
?>
</select>
Quantity:<input type="text" name="t1">
<table border=5 align=center>
<TR><Th>ITEM ID</Th><TH>ITEM NAME</TH><TH>QUANTITY</TH><TH>PRICE</TH></TR>
<?
include('adodb.inc.php');
$db=ADONewConnection("postgres");
$db->connect("localhost","rams","","stu");
$q="select * from inv where itemname='$_POST[s2]'";
$rs=$db->Execute($q);
$in=$rs->fields['itemname'];
$ii=$rs->fields['itemid'];
$p=$rs->fields['price'];
$a=$_POST[t1];
$r=$_POST[t1]*$p;
echo "<TR><TD>$ii</TD><TD>$in</TD><TD>$a</TD><TD>$r</TD></TR></table>";
?>
<input type="submit" value="add more">
</form>
</pre>
</body>
</html>[/php]
Mar 6 '07 #4
savanm
85
Hi savyatha..

i think this may satisfy ur need...

<form name="nameoftheform" method="post" action="<? echo $_SERVER['PHP_SELF']; ?>">

<? echo $_SERVER['PHP_SELF'];?>>

in the above action type we get the output with in the same file..

So try this one
Mar 6 '07 #5
ronverdonk
4,258 Expert 4TB
savyata: read the Posting Guidelines before you post any more in this forum!
Especially the part about enclosing shown code with code or php tags!

moderator
Mar 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: George Stout | last post by:
First off I do not know alot about writing queries to an Access Database from an ASP page. This is why I need help. I have an Events database for 6 colleges in our metro area. On the homepage I...
8
by: joe | last post by:
Some time ago I set up an ASP application that used a login page which checked a username and password against a database to determine a users authorization to access certain pages on the site....
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
11
by: Rob | last post by:
I know, I know, don't use frames. Well, I'm stuck with these frames and I'm trying to add functionality without a complete redsign. You can look at this as a nostalgic journey. Anyway, I've got...
12
by: Dave G | last post by:
Apologies if this has been covered before - I couldn't find it. I currently use ASPEmail to create and send HTML emails from an Access database. The text is personalised and includes embedded...
2
by: raji20 | last post by:
This is my first page named test.php, In this page iam assigning the value to the session variable username,and I could able to access that value in this page. But when I access the same...
0
by: yukijocelyn | last post by:
I have experienced a problem here while doing a form for accessing datadbase using MS Access. I'm using the AccessDataSource control, and using Gridview to pull the data from the database. I am able...
3
by: madhuribond | last post by:
Hi All, I need your help, i have 3 html pages and one aspx page.After visiting the aspx page it creates one session variable this variable i want to access in all my html pages thru anyway....
7
by: tshad | last post by:
How do you hide an asp.net object and still be able to access it? I had my email in a session variable, but you can't access the session variable from Javascript (I don't think - since Javascript...
7
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.