$bool 允许吗?" />

PHP:使用 post 检索“用户输入的数据”在伪代码中&是 Array("value) => $bool 允许吗?

发布于 2024-12-07 18:26:55 字数 965 浏览 3 评论 0 原文

尝试为张贴在我的大学的招聘海报编写一些 PHP 伪代码。

这个想法是让读者在脑海中浏览一下需求列表,如果他们认为自己符合描述,就可以查看二维码。

不幸的是,我几乎没有 PHP 经验,因此在弄清楚以下三件事时遇到一些困难:

  1. 我是否需要使用 $post(...的值) 来“检索”他们的个人信息,或者只是简单地说明变量/布尔值足够了吗?

  2. 我可以像在 $skills 中那样使用数组吗?基本上我希望读者想象以下内容: myskill

  3. 像这样为 $interests 的数组条目分配 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";
        }
    }
}

?>

Trying to write some PHP pseudocode for a recruitmentposter to hang at my university.

The idea is to make readers walk through a list of requirements in their head and go to the QR code if they think they fit the description.

Unfortunately I have virtually no experience @ PHP and therefore am having some difficulty figuring out the following three things:

  1. Do I need to use $post(value of ...) to 'retrieve' their personal information or is simply stating the variable/bool enough?

  2. Can I use an array like I did in $skills? Basically I want readers to imagine the following: skilltype | myskill

  3. Is assigning a bool value for the array entries of $interests correct like this? Here I'd want readers to think: Interest | personalboolvalue

It would be no surprise to me if this is complete and utter nonsense but it's what I produced after about an hour and a half of sleep-deprived searching. I'd be ever grateful if anyone could shed some light on the matter.

<?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";
        }
    }
}

?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听风吹 2024-12-14 18:26:55

具有良好 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>

Full working solution with nice 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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文