“Formula” Kod odpowiedzi

formularz postu PHP do siebie

// Here is how to post form data to self or to the same page & 
// avoid the PHP_SELF exploits at the same time.
<form name="my_form" method="post"
  action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> 
</form>
Geeky Bravo

Formula

<?php if (!empty($_POST)): ?>
    Welcome, <?php echo htmlspecialchars($_POST["name"]); ?>!<br>
    Your email is <?php echo htmlspecialchars($_POST["email"]); ?>.<br>
<?php else: ?>
    <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
        Name: <input type="text" name="name"><br>
        Email: <input type="text" name="email"><br>
        <input type="submit">
    </form>
<?php endif; ?>
Tamer Jarrar

Odpowiedzi podobne do “Formula”

Pytania podobne do “Formula”

Więcej pokrewnych odpowiedzi na “Formula” w PHP

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu