Hello- (Sorry for the cross posts- I should have posted in this forum instead). I am a new student to PHP. I am very lost with the current project I am working on. We are supposed to create a searchable picture directory. If all three parameters are entered correctly, the whole directory will show, otherwise the user will get error messages. I am stuck on three areas:
- How and where do you incorporate a CSS file in PHP? I have done it for HTML, but not PHP.
- We are supposed to use one for each function for three arrays. How do you code this??
- I’m not sure if I’m even coding the error section correctly for each parameter (bios, people, avatars). Am I even heading in the right direction?
Any help would be greatly appreciated.
[php]
Project Picture Directory :(Project Picture 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 people parameter not found: A parameter to display the number of people to display.
Error avatars parameter not found: A parameter to include or exclude avatars was not supplied. A value of "y" or "n" was expected.
Error bios parameter not found: A parameter to include or exclude avatars was not supplied. A value of "y" or "n" was expected.
<h2>There are 3 errors(s) you must review</h2></p>
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]
inc_vars php file<link href="project.css" type="text/css" rel="stylesheet"/>
<?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]
[code]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;}[/code]