php - PHP5 POST HTML Form Data (inputs data, selection) -
this question has answer here:
having trouble posting input types data , selections php script.
<form action="./events/upload.php" method="post" enctype="multipart/form-data"> <input type="text" name="event" id="event"><br/> <textarea rows="4" cols="50" name="description" id="description" ></textarea></br> <input type="file" name="filetoupload" id="filetoupload"></br> <input type="date" name="data" id="date"><br/> <input type="date" name="enddate" id="enddate"><br/> <select name="template" name="template" id="template"> <option value="select1">select 1</option> <option value="select2">select 2</option> <option value="select3">select 3</option> <option value="select4">select 4</option> </select><br/> <input type="submit" value="submit" name="submit"><br/> </form>
for both text , textbox can using
$event = $_request['event']; $description = $_request['description'];
if use same method data, enddate , template dont them.
$date = $_request['date']; $enddate = $_request['enddate']; $template = $_request['template']; $phase = array("event= ", $event, "description= ", $description, "image= ", $image, "date= ", $date, "end date= ", $enddate, "template= ", $template); print_r($phase);
i looking data have sting (so date string , template value string.
the reason array key's trying access case sensitive:
this work:
$date = $_request['data']; $enddate = $_request['enddate']; $template = $_request['template']; $phase = array("event= ", $event, "description= ", $description, "image= ", $image, "date= ", $date, "end date= ", $enddate, "template= ", $template); print_r($phase);
to find errors these it's practice turn on error reporting:
error_reporting(e_all); ini_set('display_errors', 1);
Comments
Post a Comment