How to fit multiple conditions in if (Operator &&)?

Good day!
Have the code (which is using toster.ru now works)
Here it is:
<?php
include_once('functions.php')
?>
<!DOCTYPE html>
<html>
the <head>
 <meta charset="utf-8">
 <title>upload image to server</title>
</head>
the <body>
 <form method="post" enctype="multipart/form-data">
 A4 <input required type="radio" name="ans" value="ans1">
 A3 <input type="radio" name="ans" value="ans2">
<br / >
 S/W <input required type="radio" name="farb" value="farb1">
 Farb <input type="radio" name="farb" value="farb2">
 <br / > 
 1 Seitig <input required type="radio" name="seit" value="seit1">
 Doppelseitig <input type="radio" name="seit" value="seit2">
<br / >
 <input type="file" name="file">
 <input type="submit" value="Upload">
</form>
<?php
 // if were sending the form
if(isset($_FILES['file']))
{
 // check whether we can load the image
 $check = can_upload($_FILES['file']);

 if($check === true)
{
 $folder = $_POST['ans'] == 'ans1' ? 'Folder_A4_SW_EIN' : 'img7';
 make_upload($_FILES['file'], $folder); // load an image to the server
 echo "<strong>File was successfully uploaded!</strong>";
}
else
{
 // print error message
 echo "<strong>$check</strong>"; 
}
}
?>
</body>
</html>

And all is good, but I need to add this if structure :
if (condition && condition). If I add (line 33)
<?php
include_once('functions.php')
?>
<!DOCTYPE html>
<html>
the <head>
 <meta charset="utf-8">
 <title>upload image to server</title>
</head>
the <body>
 <form method="post" enctype="multipart/form-data">
 A4 <input required type="radio" name="ans" value="ans1">
 A3 <input type="radio" name="ans" value="ans2">
<br / >
 S/W <input required type="radio" name="farb" value="farb1">
 Farb <input type="radio" name="farb" value="farb2">
 <br / > 
 1 Seitig <input required type="radio" name="seit" value="seit1">
 Doppelseitig <input type="radio" name="seit" value="seit2">
<br / >
 <input type="file" name="file">
 <input type="submit" value="Upload">
</form>
<?php
 // if were sending the form
if(isset($_FILES['file']))
{
 // check whether we can load the image
 $check = can_upload($_FILES['file']);

 if($check === true)
{
 $folder = $_POST['ans'] == 'ans1' && $folder = $_POST ['farb'] == 'farb1' && $folder = $_POST ['seit'] == 'seit1'? 'Folder_A4_SW_EIN' : 'img7';
 make_upload($_FILES['file'], $folder); // load an image to the server
 echo "<strong>File was successfully uploaded!</strong>";
}
else
{
 // print error message
 echo "<strong>$check</strong>"; 
}
}
?>
</body>
</html>

I get this error: Warning: copy(File.pdf) [function.copy]: failed to open stream: No such file or directory in Z:\home\OptoDruck\www\functions.php on line 33
How can I fix it? Thank you!
March 23rd 20 at 19:30
2 answers
March 23rd 20 at 19:32
Solution
If you still do not understand very well how to use the ternary operator, it is better to use a normal operator in a conditional transition
if ($_POST['ans'] == 'ans1' && $_POST ['farb'] == 'farb1' && $_POST ['seit'] == 'seit1')
 $folder = 'Folder_A4_SW_EIN';
} else {
 $folder = 'img7';
}
March 23rd 20 at 19:34

Find more questions by tags PHP