elseif(!$id)
{
echo "Do not try that! Please follow the procedure to properly edit your profile. If you feel you have found this page in error, please let us know using the contact form.";
}
};
?>

Each if, and elseif (except the last with !$id), are its seperate form on the update page.

Basically when you change newimage, you click a button to change just that, which sends that data to this page. if you change about, it just updates that, and you click the button for that form. I have 5 different forms on the previous page.

My issue is, if the field is blank, and I put if($newimage || $newimage = " ") then if the field isn't filled when you submit something in the 'about' section, then it will update $newimage, and not $about.

Not Relevant: I'm trying to figure out how to mass change everything, but I'd actually rather do it this way, cause soon I'm moving it to javascript to do side server script editing for each section, instead of having new pages. (Much further down the road, but having it ready in sections like this will make it quicker to switch.)

Thanks in advance if you can help.

Edit: It really is a logical issue. Not much of a problem with the PHP, just a "How would I work this" situation.

InsaneRhino

03-15-2008, 01:30 PM

First I think you may have problems with using = instead of == on your if statements, that has really screwed me up in the past, so check that out first.

As you are using a form it maybe easier to use a case statement. What you ideally need is some sort of ID that tells your submit page which section to process.

Like I said, the main problem here is how to work it XD. I'll look into learning the case statements, because from every angle I've looked, it seems impossible to do it this way.

abduraooft

03-15-2008, 01:46 PM

if newimage{
update it
show the message
}

if about{
update it
show the message
} I think that should work.

Deacon Frost

03-15-2008, 01:52 PM

Yes, that works, but my problem being, I need to have a way that if it's empty, it doesn't update unless you TELL it to update.

If I did:

if ($newimage || $newimage =" ")
{
// update it
// show the message
}

if ($about || $about = " ")
{
// update it
// show the message
}

The problem with that would be, that say you have an empty newimage, and then you click to edit about, what's going to happen, is it's going to update newimage, and not about. :p.

The problem with that is, if you do the way I did it, it'll delete data because it reads it as not existing because of the ! operators I have installed to try and stop it from doing that code if the other codes are being submitted.

EDIT:

So I tried it, and it deleted all the data I had EXCEPT for on the form which I clicked.

That would mean that if $newimage is NOT empty, which is what you want I presume. At the moment you have your code to if the $newimage is equal to " " which it will never be if somebody has filled the form in.

Also you may want to consider having just 1 update button, and 1 form that updates the entire page rather than 1 form for each update. Alternatively you could get up another $_GET and set the link to something like.

Well, what the problem would have been was that if it was empty, what it would do is delete everything else, and update that field.

It's a profile. so people edit when they choose, and can have empty fields, the problem with php verification of empty fields is, if they have an empty field, normally you don't want them, so there's either a really long process, or not a way to allow it at all.

I'd want it to be if it is this, or this, then it'll change (if it has data, or if it is empty).

The problem with that though, if it is empty, and another field has data that you want to save, what'll happen is it'll catch that empty field if, because it is empty, and it will update that only.

Anyways, no worries, I just switched to one button for overall editing :P. Much quicker and easier for now.

(if anyone CAN solve what I'm meaning, then I ask you to share, it still racks my brain).