Solved

PHP: Selected Checkboxes to MySQL DB Across 3 Web Pages in PHP

Posted on 2013-01-06
5
164 Views
Last Modified: 2013-01-09
Newbie here. Is the following possible?

Page 1: has a form with multiple checkboxes. All checkboxes are named prop[] (for real estate property) so they can be handled as a single item on submission to Page 2.

Page 2: User can select an existing list of properties or name a new one to be created, then submit to Page 3.

Page 3: Creates a new list of properties with the selected checkboxes from Page 1, or appends to an existing property list, to be stored in a MySQL db.

I was thinking of making an array with the checked values on Page 2, but still need to pass the array to Page 3 on submission, or perhaps with session variable, then INSERT INTO MySQL db.

Mahalo for any help.
0
Comment
Question by:SlickCatSeven
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
rinfo earned 500 total points
ID: 38750480
setting session variable is the way to go about this.
keep on depositing in a session variable array values from page1,page2 and page3 and after page 3 on the session array variable you have an array with value from all pages.
Or you can have 3 session variable page1_option,page2_option and page3_option and finally combine them into an array.,
0
 

Author Comment

by:SlickCatSeven
ID: 38756826
Okay, I tried this for creating the session variable, but no values get stored.

/*-----------------------------------------------------------------------------------
$search_array = array();
            
for ($count = 0; $count <= count($_POST['prop[]']) - 1; $count++) {
   if ($_POST['prop[]'][$count] <> '') {
      $search_array = $_POST['prop[]'][$count];
   }
}

$_SESSION['$search_array'] = $search_array;
/*-----------------------------------------------------------------------------------
0
 
LVL 9

Expert Comment

by:rinfo
ID: 38757929
Have you checked whats there in the prop[].
0
 

Author Comment

by:SlickCatSeven
ID: 38760976
Yup, it was a problem with prop[].
0
 

Author Closing Comment

by:SlickCatSeven
ID: 38760978
Aloha!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

895 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

12 Experts available now in Live!

Get 1:1 Help Now