试图写一些PHP伪代码为招聘海报挂在我的大学。
这个想法是让读者在脑海中浏览一份需求清单,如果他们认为自己符合描述,就去看二维码。
不幸的是,我几乎没有@ PHP的经验,因此我有一些困难弄清楚以下三件事:
-
我是否需要使用$post(…的值)来"检索"他们的个人信息,或者只是简单地说明变量/bool足够?
-
我可以使用数组,就像我在$技能?基本上我希望读者想象如下:skilltype | myskill
-
是否为$interest的数组项分配bool值这样正确?这里我希望读者们思考一下:兴趣| personalboolvalue
如果这完全是胡说八道,我不会感到惊讶,但这是我经过一个半小时的睡眠不足的搜索后得出的结果。如果有人能对这件事提供一些说明,我将不胜感激。
<?php
$skills = array ("PHP" => $level, "HTML5" => $level, "CSS3" => $level, "SQL" => $level);
$interests = array ("iOS" => $bool, "start_up" => $bool, "money" => $bool);
if ($skill[0, 1, 2, 3] == "expert") {
if ($interests[0, 1] == TRUE && $interests[2] == FALSE) {
if ($interested && $entrepreneur && $concrete_exp && $willing_to_commit) {
echo "Please go to /images/qrcode.png";
}
}
}
?>
完整的工作解决方案与漂亮的HTML:
<?php
// form submission haldling
if (isset($_POST["submit"])) {
if (isset($_POST["skills"]) &&
isset($_POST["interests"]) &&
$_POST["skills"] == array("PHP", "HTML", "CSS3", "SQL") &&
$_POST["interests"] == array("iOS", "start_up")) {
header("location: /images/qrcode.png");
} else {
echo "We are not interested by your profile.";
}
}
$skills = array("PHP", "HTML", "CSS3", "SQL", "World of Warcraft");
$interests = array("iOS", "start_up", "money");
?>
<form name="poll" action="" method="POST">
<fieldset>
<legend><h2>Skills</h2></legend>
<?php foreach ($skills as $skill) : ?>
<div>
<input type="checkbox" name="skills[]" id="<?php echo $skill ?>" value="<?php echo $skill ?>">
<label for="<?php echo $skill ?>"><?php echo $skill ?></label>
</div>
<?php endforeach; ?>
</fieldset>
<fieldset>
<legend><h2>Interests</h2></legend>
<?php foreach ($interests as $interest) : ?>
<div>
<input type="checkbox" name="interests[]" id="<?php echo $interest ?>" value="<?php echo $interest ?>">
<label for="<?php echo $interest ?>"><?php echo $interest ?></label>
</div>
<?php endforeach; ?>
</fieldset>
<input type="submit" name="submit"/>
</form>