php

Register for news feed

<?php
include "connect.php";
if(isset($_POST["subscribe"])){
  
  $fullname = $_POST["fullname"];
  $email = $_POST["email"];

  //Check that all feilds are filled in
  if(!empty($name) || empty($email)){
    echo "You have to fill out all fields";
  }

  //Check That full name string length
  if(strlen($fullname) <4) {
    echo "Your full name must be more than 4 charactors and less than 30.";
  }

  //Check that the names in database are not the same
  //Code must go here

  $query = "INSERT INTO subscriptions (fullname, email) VALUES ('$fullname', '$email')";
  $run = mysqli_query($conn, $query);
  if($run){
    echo "<script>alert('You have successfully subscribed')</script>";
  }

}
?>

Code to get people who have registered for news feed

Was this helpful?