Skip to content

Instantly share code, notes, and snippets.

@Sentinel17
Last active February 22, 2018 18:25
Show Gist options
  • Save Sentinel17/a2bd4a7224abd083ec874cdf39342575 to your computer and use it in GitHub Desktop.
Save Sentinel17/a2bd4a7224abd083ec874cdf39342575 to your computer and use it in GitHub Desktop.
Домашнее задание №4
<html>
<head>
<style>
.error{
border:1px solid red;
}
input{
width: 300px;
font-size: 13px;
padding: 6px 0 4px 10px;
border: 1px solid #cecece;
background: #F6F6f6;
border-radius: 8px;
padding-bottom: 5px\0;
outline:none;
}
textarea{
font-size: 13px;
overflow: auto;
resize: none;
width: 300px;
height: 50px;
background: #f6f6f6;
border: 1px solid #cecece;
border-radius: 8px;
padding: 8px 0 8px 10px;
margin: 20px 0;
outline:none;
}
.submit{
cursor: pointer;
border: 1px solid #cecece;
background: #f6f6f6;
box-shadow: inset 0px 20px 20px #ffffff;
border-radius: 8px;
padding: 8px 14px;
margin: 10px 80px;
width: 120px;
outline:none;
}
#check{
width: 20px;
}
.submit:hover{
box-shadow: inset 0px -20px 20px #ffffff;
}
</style>
<head>
<body>
<?php
$is_auth = false;
if (isset($_POST['submit'])){
$name = strip_tags($_POST['name']);
$message = strip_tags($_POST['message']);
}
if (isset($_REQUEST['checkbox']) and $_REQUEST['checkbox'] == 1) {
$is_auth = true;
}
if(!$is_auth):
?>
<form action="" method="POST">
<input name="name" placeholder="Имя" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" class=" <?php echo (isset($_POST['name']) and empty($name)) ? 'error' : '';?>" ><br>
<textarea name="message" placeholder="Ваше сообщение" class="<?php echo (isset($_POST['message']) and empty($message)) ? 'error' : '';?>"><?php if (isset($_POST['message'])) echo $_POST['message']; ?></textarea><br>
<input type="hidden" name="checkbox" value='0'>
<input type="checkbox" name="checkbox" id="check" value='1'>
<label for="check">Скрыть форму</label><br>
<button type="submit" name='submit' class="submit" value=1>Отправить</button>
</form>
<?php endif;
echo 'Имя: '.$name.'<br>'.'Сообщение: '.$message;
?>
</body>
</html>
@svetiks-v
Copy link

в строках 58-59 переменные$name и $message ещё необходимо обработать функцией. которая обрежет конечные пробелы

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment