Jump to content

3 pages linking with a two database tables.


username01

Recommended Posts

Hi everyone. I would like to do this:

In page1.php, I need to make a few checkboxes, which when the user clicks "next" button, transfers the data (which checkboxes were clicked) to a database table. Then, when the user clicks a button "next", he is moved to another page, page2.php, from which he is automatically transferred to page3.php. At page3.php those values are gathered from the database, and the user has to click "next" button again, then those values are written into another table, in the same or another database.

 

How can I do this? I've not much knowledge with neither SQL, neither PHP. I hope you will help me make this work, I'm making a little system for my HTML website. :) Thanks, if you do!

Link to comment
Share on other sites

Thanks for your reply. I will try to explain it more clearly.

 

There is index.php with 5 checkboxes and a username field. User checks any number of those checkboxes, writes his name and clicks "next" button.

After he clicks "next", the data, which is different, from which checkboxes were checked, is transferred to database1. For each checkbox, there is a letter. For example - for first - a, second - b, third - z, fourth - d, fifth - l. His username too. Also, if possible, the date and his IP address (at least the date).

So he is on page1.php now... He do something on this page (unrelated to this system), in the end he is transferred to page2.php.

So he is at page2.php now. The page2.php collects the values from the database1, and automatically checks checkboxes, so they look like at index.php. Also, it prints his IP address and name. Every value can be still changed. There is a "next" button. When the button is clicked, the values from these checkboxes, then are transferred to database2 and insert in 3 columns - name, ip and letters(checkboxes).

 

I hope, that I made this explanation clearer. :)

Link to comment
Share on other sites

No, I don't. I have a control, what to send to the site... Hmm. I could ask to do it another way, but then it would a little different.

 

I could send some data to the 'unrelated' site, and send the data from the checkboxes to the database. Then, when the site will send the user to my chosen site... It could be, that it would do some different thing. Hm. Maybe, if someone could say, that he/she could do it, could send me a PM, and I could give the details, why and what exactly would be the use of it.

Or, maybe I could PM you, Pikachu, and ask for advice, what would be the reliable way to do it? I don't want to post the exact use of this system I thought of in public.

Link to comment
Share on other sites

The major issue I can foresee here is that you insert a record into the database, send the user off to another, unrelated site, and expect that they'll always come back and continue the process. I think you're going to end up a lot of orphaned records in the database because you have no way of ensuring the user returns. On the other hand, if you were to keep the user on your site, and use something like cURL to send the data to the other site, you'd have much better control over the flow, you could store the form data in a $_SESSION var, and insert it all at once when the final form is submitted.

Link to comment
Share on other sites

Based on what you've said, I think the first thing I'd try would be storing the results of the first form in $_COOKIEs. Then when the user returns from the external site, use the $_COOKIE values to populate the next form. When that form is submitted, you can save the data to the database. That should help keep orphaned records to a minimum, and still allow you to access the data from the first form when the user returns.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.