• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 274
  • Last Modified:

Using isset to return to same page with updated info

I have a page that I want some variables to stay the same and others to reset on an add button push. I think I can do it with the isset command but I am not sure how. Here is how my page is working:

//Get the order number - auto incremented so only used as a reference
$result = mysql_query("SELECT COUNT(onum) as number FROM orders", $con);
$ordernumquery = mysql_fetch_row($result); 
$ordernumquery = $ordernumquery[0]; // mysql_fetch_row returns an array. we only want the Name so we just set it excluseively.
$ordernumquery +=1;

Open in new window

I want to keep the $ordernumquery the same so when they add an item I can reuse it to query the database for the items already added.

The other variables I would also like the keep the same are the customer, Check out date and return date. When they are completed I want to put a submit button at the bottom that will add the last record and go back to the menu.

Here is what my page looks like. I have hard coded my ordernumquery so you can see the item results.
 Screen print
  • 3
  • 2
1 Solution

Are these variables being sent via $_POST or $_REQUEST ?  what action triggers the page refresh to cause the variables to be checked?

Hope this helps
teedo757Author Commented:
They are being sent via $post.  The entire page is under the same form. Right now the add button submits the form but is not currently tied to a page to upload to the database.


Hope that helps
Mohamed AbowardaSoftware EngineerCommented:
Store $ordernumquery in sessions variable:

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

teedo757Author Commented:
Even with the link I was not able to get this to work correctly. An example with my specific problem in mind may have helped
Mohamed AbowardaSoftware EngineerCommented:
> I want to keep the $ordernumquery the same so when they add an item I can reuse it to query the database for the items already added.

Sessions will do EXACTLY what you want, why did you assigned grade C?
teedo757Author Commented:
Sorry I must just grade a little harder then most. I understand this is free advice and I do appreciate all the comments. I was just expecting some explanation on how to use a session. I try to search for solutions to my problems before posting and had run across several sites using sessions and using issset I was having a problem implementing it into my project.

I should have and will in the future give more time before closing a question. I had just found another solution to my problem and did not want to leave an unneeded question open. Thanks for the comments.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now