0

Having some trouble posting input types data and selections to a 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 and textbox i can easily get it by using

$event = $_REQUEST['event'];
$description = $_REQUEST['description'];

If i use the same method to get data, endDate and Template i dont get anything from 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 am simply looking to get the data they have as a sting (so date as a string and the Template value as a string.

AceScottie
  • 103
  • 1
  • 12

1 Answers1

1

The reason is that the array key's you are trying to access are case sensitive:

this will 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 like these it's a good practice to turn on error reporting:

error_reporting(E_ALL);
ini_set('display_errors', 1);
wodka
  • 1,320
  • 10
  • 20