0

I am not getting the output when the form is submitting. Here is my current effort. I am new to php, have tried various techniques but nothing seems to be working. the file just refreshes an empty page.

  <?php 
require("common.php"); 
if(empty($_SESSION['Id'])) 
{ 
    header("Location: login.php"); 
    die("Redirecting to login.php"); 
} 
else
   { 
     include 'top.php'; 

 if (!empty($_POST['headline'])){ 

     $type =  $_POST['type'];
     $sector =  $_POST['sector'];
     $target = $_POST['target_sector'];
     $headline = $_POST['headline'];
     $desc = $_POST['desc'];
     $fb = $_POST['fb'];
     $link = $_POST['website_link'];
     $twitter = $_POST['twitter'];



    echo "$type"; 
    echo "$headline"; 
    echo "<h2>$headline</h2>"; 


 ?><?php
 } 
else 
{ 
?> 

           <div class="container">
<br><br><br><br><br>

    <form name="registration" action="<?php echo $_SERVER['REQUEST_URI'];?>"        method="POST"/>
  <div class="form-group">
      <input id="logo_name" class="form-control" type="file" name="logo_name">
  </div>

    <div class="form-group">
        <select id="type" name="type" class="form-control">
          <option>B2B</option>
          <option>B2C</option>
        </select>
    </div>

    <div class="form-group">
        <select id="sector" name="sector" class="form-control">
          <option>B2B</option>
          <option>B2C</option>
        </select>
    </div>

    <div class="form-group">
        <select id="target_sector" name="target_sector" class="form-control">
          <option>B2B</option>
          <option>B2C</option>
        </select>
     </div>

      <div class="form-group">
        <input class="form-control" type="text" id="headline" name="headline" placeholder="Advertisement Title">
     </div>

     <div class="form-group">
        <textarea class="form-control" type="text" rows="5" id="desc" name="desc" placeholder="Advertisment Text"></textarea>
     </div>

     <div class="form-group">
        <input class="form-control" type="text" id="website_link" name="website_link" placeholder="Website Link">
     </div>

     <div class="form-group">
        <input class="form-control" type="text" id="fb" name="fb" placeholder="Facbook URL">
     </div>

     <div class="form-group">
        <input class="form-control" type="text" id="twitter" name="twitter" placeholder="Twitter URL">
     </div>

      <div class="form-control">
        <input type="submit"/>
      </div>
</form>

user2620804
  • 133
  • 11
  • what do you have in your common.php and where is your `session_start`? And one more, form closing `>` missing after action. – mim. Dec 06 '16 at 22:36
  • at least in this snippet you're missing the to close off the else after – dpp Dec 06 '16 at 22:41
  • common is my database settings which works for everything else. I don't see where I am missing a > as this is after the method="post" – user2620804 Dec 06 '16 at 22:41
  • I ave the closing . It has just missed it out for some reason – user2620804 Dec 06 '16 at 22:47

0 Answers0