Submit button isn't sending everything | Bootstrap [duplicate] - php

This question already has answers here:
Form not showing input data
(2 answers)
Closed 2 years ago.
My submit button isn't sending all the form data.
I have an index.php with a bootstrap form and a create.php which does an echo on my form when it is submitted.
Problem I'm encoutering is is that none of the fields with user input are actually getting sent to my create.php, only the default Radio is getting sent
<?php
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
<title></title>
</head>
<body>
<div id="form">
<form action="./create.php" method="post">
<img src="https://i.imgur.com/jDiqUAy.jpg" width="20%" heigth="20%">
<div class="form-group">
<label for="nameInput">Naam van uw kat</label>
<input type="text" class="form-control" id="nameInput" placeholder="Henkie">
</div>
<div class="form-group">
<label for="emailInput">Email address</label>
<input type="email" class="form-control" id="emailInput" placeholder="name#example.com">
</div>
<div class="form-group">
<label for="inputPassword">Wachtwoord</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Bananen123">
</div>
<div class="form-group">
<label for="selectOptions">Kleur van uw kat</label>
<select class="form-control" id="selectOptions">
<option>Zwart</option>
<option>Wit</option>
<option>Oranje</option>
<option>Zwart met wit</option>
<option>Grijs</option>
</select>
</div>
<div class="form-check">
<p>Extras</p>
<input class="form-check-input" type="radio" name="hairRadio" id="hairRadio1" value="long" checked>
<label class="form-check-label" for="hairRadio1">
Lang
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="hairRadio" id="hairRadio2" value="short" checked>
<label class="form-check-label" for="hairRadio2">
Kort
</label>
</div>
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" id="litterCheckbox" value="">
<label class="form-check-label" for="litterCheckbox">
Kattenbak
</label>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary">Verstuur</button>
</div>
</div>
</form>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy"
crossorigin="anonymous"></script>
</body>
</html>
create.php
<?php
echo var_dump($_POST);

It's because you didn't define name attribute for other inputs! Each input need name attribute so that it's data can be send with form.

For an input to be sent name attribute is required.

name attribute for your input is missing. Add that and it should solve the problem

Related

Simple template import

How to make it so that when you access a simple page like CONTACT.PHP, it already comes with the main html embedded (TEMPLATE.PHP): Example:
PAGE CONTENT "CONTACT.PHP"
<form method="post" autocomplete="off" class="logg">
<div class="row">
<div class="col-xs-12 col-sm-4">
<div class="form-group">
<label for="aaa" class="control-label">Name</label>
<input name="name" type="text" class="form-control" value="" required/>
</div>
</div>
<div class="col-xs-12 col-sm-4">
<div class="form-group">
<label for="aaa" class="control-label">Email</label>
<input name="email" type="email" class="form-control" value="" required/>
</div>
</div>
</div>
<button type="submit" class="btn btn-success pull-right"> Save </button>
</form>
PAGE CONTENT "TEMPLATE.PHP"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<!-- PAGE CONTENT BEGINS -->
<?= contact page here ?> <<<<<<<<<<<<<<<<<<<<<<<<<<<<
<!-- PAGE CONTENT ENDS -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
Operation:
When the contato.php page is accessed, the template would also be loaded so that the layout is fully assembled.

PHP form submission error

I created new inquiry form for my website. But it's giving the following error message.
Error
Sorry there was an error sending your form.
mail:Could not instantiate mail function.
Form HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PHP Contact Form Script With Validation - reusable form</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" >
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="form.css" >
<script src="form.js"></script>
</head>
<body >
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h2>Contact Us</h2>
<p> Send us your message and we will get back to you as soon as possible </p>
<form role="form" method="post" id="reused_form">
<div class="row">
<div class="col-sm-6 form-group">
<label for="name"> First Name:</label>
<input type="text" class="form-control" id="firstname" name="firstname" maxlength="50">
</div>
<div class="col-sm-6 form-group">
<label for="name"> Last Name:</label>
<input type="text" class="form-control" id="lastname" name="lastname" maxlength="50">
</div>
</div>
<div class="row">
<div class="col-sm-6 form-group">
<label for="email"> Email:</label>
<input type="text" class="form-control" id="email" name="email" maxlength="50">
</div>
<div class="col-sm-6 form-group">
<label for="email"> Phone:</label>
<input type="tel" class="form-control" id="phone" name="phone" required maxlength="50">
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<label for="name"> Message:</label>
<textarea class="form-control" type="textarea" id="message" name="message" placeholder="Your Message Here" maxlength="6000" rows="7"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group">
<button type="submit" class="btn btn-lg btn-success btn-block" id="btnContactUs">Post It! </button>
</div>
</div>
</form>
<div id="success_message" style="width:100%; height:100%; display:none; "> <h3>Sent your message successfully!</h3> </div>
<div id="error_message" style="width:100%; height:100%; display:none; "> <h3>Error</h3> Sorry there was an error sending your form. </div>
</div>
</div>
</div>
</body>
</html>
Handler.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 './vendor/autoload.php';
use FormGuide\Handlx\FormHandler;
$pp = new FormHandler();
$validator = $pp->getValidator();
$validator->fields(['firstname','lastname', 'email','phone'])->areRequired()->maxLength(50);
$validator->field('email')->isEmail();
$validator->field('message')->maxLength(6000);
$pp->sendEmailTo('name#mail.com'); // ← Your email here
echo $pp->process($_POST);
You are not defining an action for the form.
<form role="form" method="post" id="reused_form" action="Handler.php">
<!-- html goes here -->
</form>

Radio button is not showing in page

For laravel project i use a metarial design bootstrap(MDBootstrap) template. use this template for master design and if i need to add somthing then i use #yeild(''). every thing is fine but if want to add radio button in form, this button is not showing in page.
here is my head what master.blade.php used..
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
<!-- Scripts -->
<!-- Fonts -->
<link rel="dns-prefetch" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600" rel="stylesheet" type="text/css">
<!-- Styles -->
<link href="metarial/css/mdb.min.css" rel="stylesheet">
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="metarial/bootstrap.min.css" rel="stylesheet">
at last of the body...
<script type="text/javascript" src="metarial/js/jquery-3.2.1.min.js"></script>
<!-- Tooltips -->
<script type="text/javascript" src="metarial/js/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
{{--
<script type="text/javascript" src="metarial/js/bootstrap.min.js"></script> --}}
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="metarial/js/mdb.min.js"></script>
<script>
// SideNav Initialization
$(".button-collapse").sideNav();
new WOW().init();
</script>
Form is...
<form role="form" action="{{url('/children/add')}}" method="post" enctype="multipart/form-data">
#csrf
<div class="form-group ml-4 mr-4">
<div class="row">
<div class="col-6">
<label for="name">First Name</label>
<input value="{{ old('firstName') }}" name="firstName" type="text" class="form-control" id="first" placeholder="First Name">
</div>
<div class="col-6">
<label for="name">Last Name</label>
<input value="{{ old('lastName') }}" name="lastName" type="text" class="form-control" id="last" placeholder="Last Name">
</div>
</div>
</div>
<div class="radio form-group ml-4 mr-4">
<label><input type="radio" name="optradio">Male</label>
</div>
<div class="radio">
<label><input type="radio" name="optradio">Female</label>
</div>
<div class="form-group ml-4 mr-4">
<label for="Birthday">Birthday</label>
<input name="birthday" type="date" class="form-control" id="birthday">
</div>
<div class="form-group ml-4 mr-4">
<label for="image">Profile Image</label>
<input type="file" name="image" class="form-control" id="image">
</div>
<button type="submit" style="background-color:#2DAE60;" class="btn">
<i class="fa fa-plus"></i> ADD </button>
</form>
picture of this page where radio button missing but text 'Male','Female' is remaining...
can anyone help me please?
Try changing this:
<div class="radio">
<label><input type="radio" name="optradio">Female</label>
</div>
To this:
<div class="radio">
<input type="radio" id="female-rb" name="optradio" />
<label for="female-rb">Female</label>
</div>
When using labels you should define for which radio button the label applies. You do this by adding the for attribute and let it referring the id of the radio button. To correctly render the radio button you should place the input first and then the label.

PHP Display single value from session array

I currently have a PHP form for our partners to register quotes. After the user log in they are brought to the beginning of the quote form. I would like the user's first name to display in the first form field automatically.
The user's session information includes an array of values; one of which is the firstName value. This is the value that I would like to display in the first field when the user logs in.
When I try to load the page I am getting an error instead of the user's first name.
This is the error I am getting:
Notice: Undefined index: user in C:\wamp64\www\quote_generator\quote_tool.php on line 77
Here is the updated page code:
<?php
require("config.php");
if(empty($_SESSION['user']))
{
header("Location: index.php");
die("Redirecting to index.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Quoting Tool </title>
<meta name="description" content="Teo partner quote generator tool">
<meta name="Kenneth Carskadon" content="www.kencarskadon.com">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
<link rel="stylesheet" href="assets/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/3.1.3/css/bootstrap-datetimepicker.min.css">
<link rel="stylesheet" href="assets/css/font-awesome/css/font-awesome.css">
<link rel="stylesheet" href="assets/css/form-elements.css">
<link rel="stylesheet" href="assets/css/datepicker.css">
<link rel="stylesheet" href="assets/css/style.css">
<style>
body {
background: url("assets/images/backgrounds/background.jpg") no-repeat fixed center;
background-size: cover;
}
</style>
</head>
<body>
<!-- Top menu -->
<nav class="navbar navbar-inverse navbar-no-bg" role="navigation">
<div class="container">
<div>
<a class="navbar-brand" href="#">
<img src="assets/images/logo/Teo%20Logo%20White.png" class="img-responsive" id="teo-logo">
</a>
</div>
</div>
</nav>
<!-- Top content -->
<div class="top-content">
<div class="inner-bg">
<div class="container form-container">
<div class="row">
<div class="col-sm-8 col-sm-offset-2 text">
<h1><strong>Teo</strong> Partner Quote Generation Form</h1>
</div>
</div>
<div class="row">
<div class="col-sm-8 col-sm-offset-2 form-box">
<form role="form" action="" method="post" class="registration-form">
<!-- Fieldset 1: Partner Information -->
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h2>Partner Information</h2>
<h3>Tell us who you are</h3>
</div>
<div class="form-top-right">
<img src="assets/images/icons/partner_info.png" class="form-icon">
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<input type="text" name="form-partner-name" placeholder="Partner name" class="form-partner-name form-control" id="form-partner-name"
value="<?php echo $_POST['user']['firstName']?>">
</div>
<div class="form-group">
<select name="partner-level" type="text" title="Select partner level" class="form-control" id="form-partner-level" >
<option>Select partner level</option>
<option data-price="34">Platinum</option>
<option data-price="32">Gold</option>
<option data-price="29">Silver</option>
</select>
</div>
<div class="form-group">
<input type="text" readonly="readonly" name="discount-perc" placeholder="Discount(%)" class="form-control" id="form-discount-perc">
</div><br />
<div class="form-group">
<input type="text" name="form-margin-perc" placeholder="Margin(%)" class="form-control" id="form-margin-perc">
</div>
<br /><br />
<button type="button" class="btn btn-next">Next</button>
</div>
</fieldset>
<!-- Fieldset 2: Quote Information -->
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h2>Quote Information</h2>
<h3>Tell us about your customer</h3>
</div>
<div class="form-top-right">
<img src="assets/images/icons/partner_info.png" class="form-icon">
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<input type="text" name="form-customer-name" placeholder="Customer name" class="form-customer-name form-control" id="form-customer-name">
</div>
<div class="form-group">
<input type="text" name="form-quote-number" placeholder="Quote Number" class="form-quote-number form-control" id="form-quote-number">
</div>
<div class="form-group">
<input type="text" name="form-incentive-exp" placeholder="Incentive Expiration Date" class="teo-datepicker">
</div>
<div class="form-group">
<input type="text" name="form-proposal-exp" placeholder="Proposal Expiration Date" class="teo-datepicker">
</div>
<br /><br />
<button type="button" class="btn btn-previous">Previous</button>
<button type="button" class="btn btn-next">Next</button>
</div>
</fieldset>
<!-- Fieldset 3: Select Servers -->
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h2>Select Servers</h2>
<h3>Tell us about the servers you need</h3>
</div>
<div class="form-top-right">
<img src="assets/images/icons/select_servers.png" class="form-icon">
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label for="server-select">What kind of server do you need?</label>
<select class="form-control" id="server-type-select">
<option>Please select and option below</option>
<option>Pro Server</option>
<option>Mini Server</option>
</select>
</div>
<div class="form-group">
<label for="server-select">How many servers do you need?</label>
<input type="text" name="form-server-quantity" placeholder="Number of servers" class="form-control" id="form-server-quantity">
</div>
<br /><br />
<button type="button" class="btn btn-previous">Previous</button>
<button type="button" class="btn btn-next">Next</button>
<button type="button" class="btn btn-skip">skip</button>
</div>
</fieldset>
<!-- Fieldset 4: Configure Servers -->
<fieldset>
<div class="form-top">
<div class="form-top-left">
<h2>Select Servers</h2>
<h3>Tell us about the servers you need</h3>
</div>
<div class="form-top-right">
<img src="assets/images/icons/select_servers.png" class="form-icon">
</div>
</div>
<div class="form-bottom">
<div class="form-group">
<label for="server-select">What kind of server do you need?</label>
<select class="form-control" id="server-type-select">
<option>Please select and option below</option>
<option>Pro Server</option>
<option>Mini Server</option>
</select>
</div>
<div class="form-group">
<label for="server-select">How many servers do you need?</label>
<input type="text" name="form-server-quantity" placeholder="Number of servers" class="form-control" id="form-server-quantity">
</div>
<br /><br />
<button type="button" class="btn btn-previous">Previous</button>
<button type="button" class="btn btn-next">Next</button>
<button type="button" class="btn btn-skip">Skip</button>
</div>
</fieldset>
<div class="btn-logout">
Logout
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Javascript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.backstretch.min.js"></script>
<script type='text/javascript' src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>
<script src="assets/js/bootstrap-datepicker.js"></script>
<script src="assets/js/scripts.js"></script>
<!--[if lt IE 10]>
<script src="assets/js/placeholder.js"></script>
<![endif]-->
</body>
</html>
Update: I have a session page that shows me the information on the current session, and these are the results for the form I am talking about:
View Image
The screenshot clarified it.
You should be able to use
$session['user']['firstName']
As noted in the comments above though, you will want to migrate away from using eval, which has security implications.

Form submitting but mysql query not properly functioning [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
The following code gives a signup form that i created but unfortunately though it works the mysql query fails and returns the error message unsuccessfull signup! how can i correct this?
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com - No Copyright -->
<title>Arsiri Textile </title>
<meta charset="utf-8">
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Theme Made By www.w3schools.com - No Copyright -->
<title>Arsiri Textile </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/basic.css">
<style>
</style>
</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="60">
<div class="header" style="height:60px;background:#330d00;width:1350px">
<a class="navbar-brand" href="#myPage">ARSIRI TEXTILE |</a>
<ul class="nav navbar-nav navbar-left">
</ul>
<ul class="nav navbar-nav navbar-right">
<li>About Us</li>
<li>Contact Us</li>
<li>Login</li>
<li> Signup</li>
</ul>
</div>
<div class="image" style="height:530px; width:1350px" >
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css" />
</head>
<body>
<div class="panel panel-default">
<div class="panel-heading" style="background:#330d00;">
<h3 class="panel-title">Customer Registration</h3><br>
</div>
<div class="panel-body" >
<form class="form-horizontal" role="form" action="signupaction.php" method="post" >
<div class="form-group">
<label for="name" class="col-sm-2 control-label">First Name</label>
<div class="col-sm-10" style="width:300px">
<input type="text" class="form-control" id="name" name="firstname" required>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Last Name</label>
<div class="col-sm-10" style="width:300px">
<input type="text" class="form-control" id="name" name="lastname" required>
</div>
</div>
<div class="form-group">
<label for="Address" class="col-sm-2 control-label">Address</label>
<div class="col-sm-10" style="width:300px">
<textarea class="form-control" class="form-control" name="address"></textarea>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Contact No.</label>
<div class="col-sm-10" style="width:300px">
<input type="text" maxlength="10" class="form-control" id="name" name="contactno" required>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">E-Mail</label>
<div class="col-sm-10" style="width:300px">
<input type="email" class="form-control" id="name" name="emailaddress" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10" style="width:300px">
<input type="password" class="form-control" id="pass" name="password" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Confirm password
</label>
<div class="col-sm-10" style="width:300px">
<input type="password" class="form-control" id="confirmpass" name="cpassword" required><br>
</div>
</div>
<div class="panel-footer" style="overflow:hidden;text-align:left;">
<div class="col-sm-offset-2 col-sm-10">
<input class="btn btn-success btn-sm" type=submit name=submit value=Submit >
<input class="btn btn-success btn-sm" type=reset name=reset value=Cancel>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</div>
<div class="footer " style="background:#330d00; height:60px ;width:1350px ">
<p align="center" > Asiri all rights reserved</p>
</div>
The relevant php script(ignupaction.php) for the above html form is as follows
<?php
//importing db.php in the includes folder
require("includes/db.php");
$fname=$_POST["firstname"];
$lname=$_POST["lastname"];
$address=$_POST["address"];
$contact=$_POST["contactno"];
$email=$_POST["emailaddress"];
$password=$_POST["password"];
$cpassword=$_POST["cpassword"];
$sql="INSERT INTO `signup` VALUES ('$fname','$lname','$address','$contact','$email','$password',$cpassword')";
$result=mysqli_query($db,$sql);
if(!$result){
echo "Unsuccessful signup";
}
else{
echo "Successful signup";
}
?>
when the form is submitted it returns unsuccessful signup! how can i correect this?
$sql="INSERT INTO signup VALUES ('$fname','$lname','$address','$contact','$email','$password',$cpassword')";
you are missing a ' on the last variable. you have '$password',$cpassword' <----- missing '. Also change the ticks around 'signup'.
Try this :
$sql="INSERT INTO 'signup' VALUES ('$fname','$lname','$address','$contact','$email','$password','$cpassword')";

Categories