Hello- I am a student who is new to PHP. For our current project, I am very lost. We are supposed to create a searchable picture directory. If all the parameters are entered in correctly (people, avatars, bios), the whole directory will show. I am stuck on three things:
- How or where do you include a CSS file? I’ve done it for HTML, but not PHP.
- We need to use one for each function for the three arrays. How do you do this?
- I have no idea if I am even coding the error section correctly. Am I even heading in the right direction?
Help!
[php]
Fake DirectoryPicture Directory
<?php include("inc_vars.php"); echo $_GET[people]; ?> <p>First Name: <input type="text" name="FirstName"></p>
<p>Last Name: <input type="text" name="surName"></p>
<p>
<input type="reset" value="Clear Form">
<input type="submit" value="Send Form" name="Submit">
</p>
Error!
Joe Lagana/President and CEO/Lagana Tech
Gayle Ujifusa/VP of Sales/Elguji Software
Scott Fisher/VP of Accounting/Drugco Inc.
Jeff Hendryx/Programmer/Mobil Solutions, Inc.
Paul Yee/Systems Analyst/Sharp Systems
James Farrier/Systems Analyst/Sharp Systems
Marshall Pinder/VP of Marketing/Sharp Systems
Kelly Callahan/Lead Designer/Wry Toast Designs
Allison Pierce/Teacher/Distric 42
Erin Varner/Student/EWU
PHP include file
[php]
inc_vars php file <?php $people = array("Joe Lagana","Gayle Ujifusa","Scott Fisher","Jeff Hendryx","Paul Yee","James Farrier","Marshall Pinder","Kelly Callahan","Allison Pierce","Erin Varner"); $avatars = array("malehead.png","femalehead.png","malehead.png","malehead.png","malehead.png","malehead.png","malehead.png","femalehead.png","femalehead.png","femalehead.png"); $bios = array("President & CEO "\n"; Laganatech","VP of Sales "
\n"; Elguji Software","VP of Accounting "
\n"; Drugco Inc.","Programmer "
\n"; Mobile Solutions, Inc.","Systems Analyst "
\n"; Sharp Systems","Systems Analyst "
\n"; Sharp Systems","VP of Marketing "
\n"; Sharp Systems","Lead Designer "
\n"; Wry Toast Designs","Teacher "
\n"; District 42","Student "
\n"; EWU"); foreach ($people as $key => $value){ echo "{$people[$key]}{$avatars[$key]}{$bios[$key]}\n"; } /*if (isset ($_GET ["people"]) echo "Yes, it is set."; else { echo "No, it is not set."; }*/ mkdir("picture directory"); $errorflag= FALSE; $errortext= FALSE; //people parameter isset ($_GET ['$people']){ if $_GET ['$people'] > 0 && $_GET ['$people'] <= 10); $total_people = $_GET ['$people']; } else { $errorflag= TRUE; $errortext= "People arguement requiring numbers between 1 and 10"; } else { $errorflag= TRUE; $errortext= "No person arguement found."; } //bio parameter isset ($_GET ['$bios']){ if $_GET ['$bios'] > 0 && $_GET ['$bios'] <= 10); $total_bios = $_GET ['$bios'];} else { $errorflag= TRUE; $errortext= "People arguement requiring correct name."; } else { $errorflag= TRUE; $errortext= "No person arguement found."; } // avatar parameter isset ($_GET ['$avatars']){ if $_GET ['$avatars'] > 0 && $_GET ['$avatars'] <= 10); $total_avatars = $_GET ['$avatars'];} else { $errorflag= TRUE; $errortext= "People arguement requiring correct picture."; } else { $errorflag= TRUE; $errortext= "No person arguement found."; } ?> [/php]
CSS file
[code][color=blue]body {font-family:Verdana,Arial;
margin:0;
padding:0;
background-color:#fafafa;}
#wrapper {
background-color: #cccccc;
width:900px;
}
#errors {background-color:red;
width:860px;
padding:20px;
}
.row {
background-color:#cacaca;
border-bottom:1px solid #fff;
padding:40px;
}
.avatars {margin-bottom: 5px;}[/color[/code]