Tabs on Edit Profile page

Hello,

I would like to use tabs on my User Profile page as there are quite a lot of fields now for a user. For example, I will have one tab for "contact details" and another tab for "address details".

I have tried inserting multiple forms for each of the tabs but the problem is that the error checking pops up a message to say all the fields are not completed. So when I try updating "address details" it says, "Please enter your first name!" but this is on the "contact details" tab.

Could someone please tell me how I can configure the error checking to only check a specific form? I guess I need to do something with the form's name...?

Thank you,
Greg

Hi Greg,

What method are you using to break up the page into tabs? Is it a seperate PHP file for each one? If so, you need to remove the error checking at the top of the page that isn't relevant to the current tab. For example, the error checking for the name is:

    if     (!@$_REQUEST['fullname'])            { $errorsAndAlerts .= "You must enter your full name!<br/>\n"; }

So you'd need to remove that line to stop error checking system for looking for the users name.

If the tabs are all in the same PHP file, and are sharing the same code to update the fields, you'd need to update the hidden save variable in each form so that it's unique:

  <input type="hidden" name="save" value="1" />

So the first form could have a name of save, the second of save2, the third of save3, etc.

Then you'd need to duplicate and update the save code at the top of the file for each form. The code that saves and updates the user's details is found in this if statement:

  ### Update User Profile
  if (@$_POST['save']) {

Let me know if you have any questions.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com