you may download this to see the whole thesis program. I'm more for now on functionality than design interface.

this about a problem on the get_value.php to the receipt.php

the problem:

I can get now the value using session functions but the problem is.... the list of checked items from the body.php (search the list of items) that was run by postback.php thru AJAX now from the body.php viewed on broweser. there was list of checkboxes... those check boxes function are done on the next page (get_value.php)... which was echoed properly.... the listed thngs which was done by the checkbox is now a big problem on the next page(receipt.php) I think the reason here is I cannot the query from the database which was properly echoed on get_value.php. Can you please help me out?

Recommended Answers

All 6 Replies

I don't understand "$bookID = $_POST["bookID"];" in receipt.php. This variable doesn't exists.

I don't understand "$bookID = $_POST["bookID"];" in receipt.php. This variable doesn't exists.

I revised my code on my own just recently... I removed the $bookID... so the code was this.

receipt.php

<!DOCTYPE html>
<html lang="en">
    <head>
      
        <title>compute</title>
    </head>
    <body>
        <?php
        session_START();
        $computePrice=$_GET['copies'];
         $conn=mysql_connect('localhost','root','')or die("cannot connect due to this error:<br/>".mysql_error());
        $selectDB=mysql_select_db("clc_books",$conn)or die("cannot connect due to this error:<br/>".mysql_error());
		 //echo " buying ". $_SESSION['bookname']." by ".$_SESSION['author']." with ".$computePrice." copies<br/>";
        
        $bookID = $_GET["bookID"];
        $getSelected="SELECT * FROM `clc_books_list` where book_id = '1'";//.$_SESSION['bookname'];
        $query=mysql_query($getSelected,$conn)or die("cannot connect due to this error:<br/>".mysql_error());
        while ($row=mysql_fetch_array($query)){
         echo " buying ". $_SESSION['bookname']." by ".$_SESSION['author']." with ".$computePrice." copies<br/>";
        
        }
        ?>
    </body>
</html>

there's a big bang on my head now. what ever the query is. it takes the same results... like changing the bookname query into default query string. it is always the same

and yet book_id=1 is not the righr result from the database.

I don't understand your problem. This is what I changed:
get_value.php:

<form action="receipt.php" method="get">...
<input type="hidden" name="bookID" value="<?php echo $book_id;?>">
...
</form>

I don't know is it working. Can you check?

I don't understand your problem. This is what I changed:
get_value.php:

<form action="receipt.php" method="get">...
<input type="hidden" name="bookID" value="<?php echo $book_id;?>">
...
</form>

I don't know is it working. Can you check?

$_POST["bookID"] what u saw there before was from the bookID variable of the previous page. but it doesn't worked out. I thought that method=GET will take the value on what was taken in the checkbox of postback.php

so I revised my code and I posted it just recently with the new code of receipt.php here in this thread.

I don't understand your problem. This is what I changed:
get_value.php:

<form action="receipt.php" method="get">...
<input type="hidden" name="bookID" value="<?php echo $book_id;?>">
...
</form>

I don't know is it working. Can you check?

it doesn't wrk out

session_START() Why did you write like that ? Note that PHP is case-sensitive. 'START' and 'start' are different.

Write stabilized and obey the standard.

there's a big bang on my head now. what ever the query is. it takes the same results... like changing the bookname query into default query string. it is always the same

and yet book_id=1 is not the righr result from the database.

What does it mean ? You query from the table where 'book_id' with value '1'. So, the result will always be same.

while ($row=mysql_fetch_array($query)){
echo " buying ". $_SESSION." by ".$_SESSION." with ".$computePrice." copies<br/>";

}

Furthermore, what for this 'while..loop'. What is the reason for that looping section. You are not trying to get or return any value from that loop.

Your question is not clear. Post your codes where the problem appears and make your question understandable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.