Deacon Frost
03-15-2008, 11:18 AM
Ok, my problem is that the way I have it checking to display makes it really difficult to understand. I have a series of elseifs to update where needed.
What I need to do:
1. Successfully use || to do 1 if without interfering with the other elseifs, ifs, or elses.
2. Not lose anything XD. (Done twice now).
<?php
{
if($newimage = " " && !$about && !$interests && !$services && !portfolio)
{
mysql_query( $update1 );
echo "You have edited your profile picture. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($about = " "&& !$newimage && !$interests && !$services && !portfolio)
{
mysql_query( $update2 );
echo "You have edited your 'About Me' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($interests = " " && !$newimage && !$about && !$services && !portfolio)
{
mysql_query( $update3 );
echo "You have edited your 'My Interests' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($services = " " && !$newimage && !$interests && !$about && !portfolio)
{
mysql_query( $update4 );
echo "You have edited your 'My Services' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($portfolio = " "&& !$newimage && !$interests && !$services && !$about)
{
mysql_query( $update5 );
echo "You have edited your 'My Portfolio' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
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.
What I need to do:
1. Successfully use || to do 1 if without interfering with the other elseifs, ifs, or elses.
2. Not lose anything XD. (Done twice now).
<?php
{
if($newimage = " " && !$about && !$interests && !$services && !portfolio)
{
mysql_query( $update1 );
echo "You have edited your profile picture. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($about = " "&& !$newimage && !$interests && !$services && !portfolio)
{
mysql_query( $update2 );
echo "You have edited your 'About Me' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($interests = " " && !$newimage && !$about && !$services && !portfolio)
{
mysql_query( $update3 );
echo "You have edited your 'My Interests' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($services = " " && !$newimage && !$interests && !$about && !portfolio)
{
mysql_query( $update4 );
echo "You have edited your 'My Services' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
elseif($portfolio = " "&& !$newimage && !$interests && !$services && !$about)
{
mysql_query( $update5 );
echo "You have edited your 'My Portfolio' section. <br /> Return to your <a href='http://www.chrysys.net/portfolios.php?id=".$id."'>profile</a>.";
}
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.