Using isset to return to same page with updated info

Posted on 2011-04-19
Last Modified: 2012-05-11
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
Question by:teedo757

    Expert Comment


    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
    LVL 3

    Author Comment

    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
    LVL 12

    Accepted Solution

    Store $ordernumquery in sessions variable:
    LVL 3

    Author Closing Comment

    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
    LVL 12

    Expert Comment

    by:Mohamed Abowarda
    > 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?
    LVL 3

    Author Comment

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now