Oggi, 10:27
Areknames69
Utente di HTML.itRegistrato dalSep 2004Messaggi141
Form con allega fileBuongiorno,
ho sviluppato questo form ma il php ho cercato di adattarlo da un vecchio file che avevo ma non riesco a capire perchè non funzioni. Se ve lo posto mi potete aiutare? Grazie
<form role="form" action="handler.php" method="post" id="reused_form">
<div class="row">
<div class="col-sm-12 form-group">
<label for="message"> Message:</label>
<textarea class="form-control" type="textarea" id="message" name="message" maxlength="6000" rows="7"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<label for="name"> Your Name:</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="col-sm-6 form-group">
<label for="email"> Email:</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label for="name"> Image Upload:</label>
<br/>
<div class="upload-btn-wrapper">
<button type="button" class="btn btn-default" >Browse</button>
<input type="file" name="image" />
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<button type="submit" class="btn btn-lg btn-default pull-right" >Send →</button>
</div>
</div>
</form>
PHP:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
/*
Tested working with PHP5.4 and above (including PHP 7 )
*/
require_once 'handler.php';
use FormGuide\Handlx\FormHandler;
$pp = new FormHandler();
$validator = $pp->getValidator();
$validator->fields(['name','email'])->areRequired()->maxLength(50);
$validator->field('email')->isEmail();
$validator->field('message')->maxLength(6000);
$pp->attachFiles(['image']);
$pp->sendEmailTo('info@miosito.it'); // ← Your email here
echo $pp->process($_POST);