PostgreSQL Data Table will not update from PHP code - php

I am using postgreSQL, PHP, and an HTML form. The form is a simple scholarship application. My connection script seems to work fine because when I click submit on the HTML form it echos "connected" and doesn't die, however no data from the form is transferred to my table. Please any guidance.
My PHP connection script: connect.php
try {
$dbConn = new PDO('pgsql:host=' . DB_HOST . ';'
. 'port=' . DB_PORT . ';'
. 'dbname=' . DB_NAME . ';'
. 'user=' . DB_USER . ';'
. 'password=' . DB_PASS);
$dbConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Set error mode to exception
echo “Connected”;
} catch (PDOException $e) {
$fileName = basename($e->getFile(), ".php"); // File that triggers the exception
$lineNumber = $e->getLine(); // Line number that triggers the exception
die("[$fileName][$lineNumber] Database connect failed: " . $e->getMessage() . '<br/>');
}
?>
My PHP submission script: form.php
<?php
require 'connect.php';
$sid = $_POST['sid'];
$firstName = $_POST['fname'];
$preferredName = $_POST['pname'];
$lastName = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$inSchool = $_POST['inSchool'];
$gDate = $_POST['gDate'];
$gpa = $_POST['gpa'];
$essay = $_POST['essay'];
$submit = $_POST['submit'];
if ($sid = ''){
$query = 'insert into student(firstname,lastname,prefname,address,city,state,zip,phone,email) values (?,?,?,?,?,?,?,?,?)';
$statement = $dbConn->prepare($query);
$statement->execute([$firstname, $lastname,$preferredname,$address,$city,$state,$zip,$phone,$email]);
}
else{
$query = 'insert into student(firstname,lastname,prefname,address,city,state,zip,phone,email) values (?,?,?,?,?,?,?,?,?)';
$statement = $dbConn->prepare($query);
$statement->execute([$firstname, $lastname,$preferredname,$address,$city,$state,$zip,$phone,$email]);
}
$query = 'select sid from student where firstname = ? and lastname = ? limit 1';
$statement = $dbConn->prepare($query);
$statement->execute([$firstname, $lastname,$preferredname,$address,$city,$state,$zip,$phone,$email]);
$results = $statement->fetch();
echo $results[0];
?>
My HTML Form: Application.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Style.css">
<title>Application</title>
</head>
<body>
<form action="form.php" method="post">
<header>
<img class="logo" src="" alt="logo">
<div>Asterisks Corporation Scholarship Application</div>
</header>
<p class="general">Please fill in all information to apply for the Asterisk's Scholarship.<p>
First Name:
<input type="text" size="15" name="fname" required />
Preferred Name:
<input type="text" size="15" name="pname" >
Last Name:
<input type="text" size="15" name="lname" required />
<p class="newSection">Contact Information</p>
Address:
<input type="text" size="50" name="address" required />
City:
<input type="text" size="15" name="city" required />
State:
<input type="text" size="15" name="state" required />
Zip Code:
<input type="text" size="1" name="zip" placeholder="####" required /><br><br>
Phone Number:
<input type="text" size="10" name="phone" placeholder="(###)-###-###">
Email Address:
<input type="text" size="50" name="email" required />
<p class="newSection">Academic Information</p>
Are you currently enrolled in school?
<input type="checkbox" id="Yes" name="yesBox">
<label for="Yes">Yes</label>
<input type="checkbox" id="No" name="noBox">
<label for="No">No</label><br><br>
What school are you enrolled?
<input type="text" size="50" name="schoolsEnrolled"><br><br>
What is/was your date of Graduation?
<input type="date" name="graduationDate"><br><br>
GPA
<input type="text" size="1" name="gpa">
<p class="newSection">What institutions have you applied?</p>
<input type="text" name="" value="" id="school" name="schoolsApplied">
<button onclick="addToList()" type="button" name="button" id="addButton">Add School</button><br>
<ul id="schoolList"></ul>
<p class="newSection">Please write a small essay as to why you should receive this scholarship and what your plans are after graduation.</p>
<textarea id="essay" style="width: 500px; height: 200px;" alignment="left" onkeyup="wordCounter(),wordsRemaining()" name="essay"></textarea>
<div>
300 Words Minimum & 500 Words Maximum
<div> Word Count: <span id="wordCount">0</span></div>
<div> Words Remaining: <span id="wordsRemaining">0</span></div>
</div>
<p class="newSection">Please confirm each of the following:</p>
<input type="checkbox" id="Transcript" name="transcriptConfirm" required />
<label for="Transcript">I have sent in all of my transcripts</label><br>
<input type="checkbox" id="Schools" name="schoolConfirm" required />
<label for="Schools">All schools that I am considering are in the US</label><br>
<input type="checkbox" id="Awards" name="awardConfirm" required />
<label for="Awards">I understand that the award is $5,000 per year for four years</label><br>
<input type="checkbox" id="Confirm" name="amountConfirm" required />
<label for="Confirm">I have received confirmation that my recommenders have emailed their letters to the Scholarship's Coordinator</label><br><br>
Please type your signature in the text box below: <br><br>
<input type="text" size="20" name="signature" required />
<div><br>
<input type="submit" value ="Submit" name="submit">
<input type="reset" value="Start Over" onclick="MinMax()">
</div>
<script>
function addToList(){
let school= document.getElementById("school").value;
document.getElementById("schoolList").innerHTML += ('<li>'+ school+'</li>');
};
function wordCounter(text){
var count= document.getElementById("wordCount");
var input= document.getElementById("essay");
var text=essay.value.split(' ');
var wordCount = text.length;
count.innerText=wordCount
}
function wordsRemaining(text){
var count= document.getElementById("wordCount");
var input= document.getElementById("essay");
var remaining = document.getElementById("wordsRemaining");
var text=essay.value.split(' ');
var wordCount = text.length;
remaining.innerText=300-wordCount
}
</script>
</form>
</body>
</html>

Related

How Do I Make My PHP Code Stop Displaying Object Not Found?

When I hit the Submit button, I got this instead:
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404.
I've gone through the entire code and I can't seem to spot the bug.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!--super global variables = $_POST & $_SESSION -->
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label>User Name: </label><input type="text" name="username" required><br><br>
<label>Secret Word: </label><input type="text" name="secret_word" required><br><br>
<label>Email: </label><input type="text" name="email" required><br><br>
<label>Age: </label><input type="number" name="age" required><br><br>
<label>Full Name: </label><input type="text" name="fullname" required><br><br>
<label>Address: </label><input type="text" name="address" required><br><br>
<label>Costumer Complaint: </label><input type="text" name="cost_comp" required><br><br>
<input type="submit" name="submit" value="submit"><br>
</form>
<?php
//Form validation and sanitization
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$raw_username = trim($_POST["username"]);
$raw_secret_word = trim($_POST["raw_secret_word"]);
$raw_email = trim($_POST["email"]);
$raw_age = trim($_POST["age"]);
$raw_fullname = trim($_POST["raw_fullname"]);
$raw_address = $_POST["raw_address"];
$raw_cost_comp = $_POST["raw_cost_comp"];
$clean_username = filter_var($raw_username, FILTER_SANITIZE_STRING);
$clean_secret_word = filter_var($raw_secret_word, FILTER_SANITIZE_STRING);
$clean_email = filter_var($raw_email, FILTER_VALIDATE_EMAIL);
$clean_age = filter_var($raw_age, FILTER_SANITIZE_STRING);
$clean_fullname = filter_var($raw_fullname, FILTER_SANITIZE_STRING);
function processCustomerQueries($clean_username, $clean_secret_word,
$clean_email, $clean_age, $clean_fullname, $raw_address, $raw_cost_comp) {
if ($clean_username && $clean_secret_word && $clean_email && $clean_age
&& $clean_fullname && $raw_address && $raw_cost_comp) {
echo "Hello Dear " . $clean_username . "<br>";
"Secret Word: " . $clean_secret_word . "<br>";
"Email: " . $clean_email . "<br>";
"Age: " . $clean_age . "<br>";
"Full Name: " . $clean_fullname . "<br>";
"Full Address: " . $raw_address . "<br>";
"Full Address: " . $raw_cost_comp . "<br>";
} else {
echo "Please fill the fields above.";
}
}
}
echo processCustomerQueries($clean_username, $clean_secret_word,
$clean_email, $clean_age, $clean_fullname, $raw_address, $raw_cost_comp);
?>
</body>
</html>
The error looks to be with how you are getting back to the action in the form, try using a blank action,
<!--super global variables = $_POST & $_SESSION -->
<form method="POST" action="">
<label>User Name: </label><input type="text" name="username" required><br><br>
<label>Secret Word: </label><input type="text" name="secret_word" required><br><br>
<label>Email: </label><input type="text" name="email" required><br><br>
<label>Age: </label><input type="number" name="age" required><br><br>
<label>Full Name: </label><input type="text" name="fullname" required><br><br>
<label>Address: </label><input type="text" name="address" required><br><br>
<label>Costumer Complaint: </label><input type="text" name="cost_comp" required><br><br>
<input type="submit" name="submit" value="submit"><br>
</form>

trouble with inserting php form data into mysql

i have trouble inserting my with php into one table of mysql, i can insert in any other table but this one here is my code (is a test code)
This is the formulario.php code
<form action="opformulario.php" method="POST">
<br><br>
<input type="text" name="nombre" placeholder="Nombre" />
<br><br>
<input type="text" name="apellido" placeholder="apellido" />
<br><br>
<input type="text" name="correo" placeholder="correo" />
<br><br>
<input type="text" name="nombre2" placeholder="Nombre" />
<br><br>
<input type="text" name="apellido2" placeholder="apellido" />
<br><br>
<input type="date" name="apellido3" placeholder="apellido" />
<input type="submit" value="aceptar" />
and this is the op formulario code
include("conexion.php");
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$correo = $_POST['correo'];
$nombre2 = $_POST['nombre2'];
$apellido2 = $_POST['apellido2'];
$apellido3 = $_POST['apellido3'];
$FechaMySQL = implode( '-', array_reverse( explode( '/', $apellido3 ) ) ) ;
$query = " INSERT INTO cliente (nom_raz,nom_com,tel_cli,cel_cli,email_cli,fecha_reg) VALUES('$nombre','$apellido','$correo','$nombre2','$apellido2','$FechaMySQL')";
$resultado = $conexion->query($query);
if ($resultado){
echo "Succesfull";
}
else{
echo "Error:<br />".mysql_error();
}
this is the table in which i am trying to insert
Mysql 'cliente' table

Mandatory fields in the html form using PHP PDO

I have a html form where i want 3 fields to be mandatory. If the user doesn't fill any one of those fields, then the form shouldn't be submitted and it should tell the user to fill in the mandatory one's. I've used PDO and i dont know how to do it. If someone could help me. Down below i've given both my html and php files.
HTML:
<html>
<head>
<title>Data Insertion</title>
</head>
<body>
<p><span class="Error">* required field.</span></p>
<form method="post" action="su.php">
<h2>Please Fill In Details</h2>
<label for="name">Name </label>
<input type="text" Placeholder="Enter your name" name="name" id="name" />
<span class="Error">*</span>
<br />
<br />
<label for="age">Age </label>
<input type="text" name="age" id="age" placeholder="Enter your age" />
<br />
<br />
<label for="mailid">MailId </label>
<input type="text" name="mailid" id="mailid" placeholder="Enter your Mail Id" />
<span class="Error">*</span>
<br />
<br />
<label for="gender">Gender </label>
<br />
<label for="male">Male </label>
<input type="radio" name="gender" id="gender" value="Male" id="male" />
<label for="female">Female </label>
<input type="radio" name="gender" id="gender" value="Female" id="female" />
<br />
<br />
<label for="qualification">Qualification </label>
<select name="qualification" value="Qualification" id="qualification">
<option value="B.E">SSLC</option>
<option value="P.G">HSC</option>
<option value="SSLC">UG</option>
<option value="HSC">PG</option>
</select>
<br /><br />
<label for="hobbies">Hobbies </label>
<br />
<input type="checkbox" name="hobbies" id="hobbies" value="Cricket" />Cricket
<input type="checkbox" name="hobbies" id="hobbies" value="Music" />Music
<input type="checkbox" name="hobbies" id="hobbies" value="Swimming" />Swimming
<br /><br />
<label for="textarea">Address </label>
<br />
<textarea name="address" id="textarea" rows="15" cols="30"></textarea>
<span class="Error">*</span>
<br /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>
PHP:
<?php
$servername = 'localhost';
$username = 'root';
$password = '';
try {
$conn = new PDO("mysql:host=$servername;dbname=testing", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if(isset($_POST['submit'])){
$name = $_POST['name'];
$age = $_POST['age'];
$mailid = $_POST['mailid'];
$gender = $_POST['qualification'];
$hobbies = $_POST['address'];
if($name !='' || $mailid !='' || $address !=''){
$sql = "Insert into user (Name, Age, MailId, Gender, Qualification, Hobbies, Address)
values ('".$_POST["name"]."', '".$_POST["age"]."', '".$_POST["mailid"]."', '".$_POST["gender"]."', '".$_POST["qualification"]."', '".$_POST["hobbies"]."', '".$_POST["address"]."')";
$conn->exec($sql);
echo "Thank you for registering";
} else {
echo "<p>Insertion failed <br/> Please enter the required fields !";
}}
}
catch(PODException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
?>
Try adding the html 5 attribute "required" on all the required input elements. For example
<input type="text" Placeholder="Enter your name" name="name" id="name" required />
You should also check the POST variables in the php code though, as this doesn't really prevent someone from abusing your service. Ex.
if(!isset($_POST['somevar'])) {
// Do insert
}
In html You should use javascript (e.g. jQuery) to control onsubmit event and validate if mandatory fields are filled with proper values, check this link: jQuery.submit()
In php You should check and validate each var before create and execute query. Simple article about it is here: Sanitize and Validate Data with PHP Filters
This would be good for the start I think ;)
Query string should contain placeholders and then statement should be prepared for execution, check this link:
PDOStatement::bindParam

Add multiple inputs with same name to mysql database

I'm trying to fill my mysqli database from a form with multiple input fields with the same structure and names using ajax, but I'm pretty stuck here. I have tried several solutions but all with te same result, only my last two input fields are send to my database.
My form looks like this;
<form id="sendform" method="post" action="#">
<fieldset>
<input type="text" value="JD01" id="shortname" name="member[shortname]" readonly />
<input type="text" value="John Doe" id="fullname" name="member[fullname]" readonly />
</fieldset>
<fieldset>
<input type="text" value="JD02" id="shortname" name="member[shortname]" readonly />
<input type="text" value="Jane Doe" id="fullname" name="member[fullname]" readonly />
</fieldset>
<input type="submit" value="Send" />
</form>
The ajax part;
$('#sendform').submit(function(e){
$.ajax({
type: 'POST',
url: 'inc/post.php',
data: $(this).serialize(),
success: function(data){
alert("Data Save: " + data);
}
});
e.preventDefault();
});
And my php;
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', 'root');
define('DBNAME', 'test');
$db = new mysqli(HOST, USER, PASS, DBNAME);
$values = array();
foreach ($_POST['member'] as $member) {
$values[] = '(' . $member['shortname'] . ',' . $member['fullname'] . ')';
}
$sql = "INSERT INTO sendform (shortname, fullname) VALUES " . implode(',', $values);
$result = $db->query($sql);
if($result) {
echo "Yep";
}
$db->close();
What am I doing wrong here? thnx!
Try this:
<form id="sendform" method="post" action="#">
<fieldset>
<input type="text" value="JD01" id="shortname" name="member[shortname][]" readonly />
<input type="text" value="John Doe" id="fullname" name="member[fullname][]" readonly />
</fieldset>
<fieldset>
<input type="text" value="JD02" id="shortname" name="member[shortname][]" readonly />
<input type="text" value="Jane Doe" id="fullname" name="member[fullname][]" readonly />
</fieldset>
<input type="submit" value="Send" />
</form>
And PHP Page:
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', 'root');
define('DBNAME', 'test');
$db = new mysqli(HOST, USER, PASS, DBNAME);
$values = array();
for($i=0 ;$i < count($_POST['member']); $i++) {
$values[] = '("' . $_POST['member']['shortname'][$i] . '","' . $_POST['member']['fullname'][$i] . '")';
}
$sql = "INSERT INTO sendform (shortname, fullname) VALUES " . implode(',', $values);
$result = $db->query($sql);
if($result) {
echo "Yep";
}
$db->close();
You can make the form look like this (note that member[] is now an array itself)
<form id="sendform" method="post" action="">
<fieldset>
<input type="text" value="JD01" id="shortname" name="member[1][shortname]" readonly />
<input type="text" value="John Doe" id="fullname" name="member[1][fullname]" readonly />
</fieldset>
<fieldset>
<input type="text" value="JD02" id="shortname" name="member[2][shortname]" readonly />
<input type="text" value="Jane Doe" id="fullname" name="member[2][fullname]" readonly />
</fieldset>
<input type="submit" value="Send" />
</form>
in your PHP use
foreach ($_POST['member'] as $member) {
$values[] = '(' . $member['shortname'] . ',' . $member['fullname'] . ')';
}
You are using member[shortname] and member[fullname] two times in html. So values from second fieldset are overriding the first one.
Hence we are getting only the values the are put in second fieldset.
You can try using following code:
<form id="sendform" method="post" action="#">
<fieldset>
<input type="text" value="JD01" id="shortname" name="member['shortname'][0]" readonly />
<input type="text" value="John Doe" id="fullname" name="member['fullname'][0]" readonly />
</fieldset>
<fieldset>
<input type="text" value="JD02" id="shortname" name="member['shortname'][1]" readonly />
<input type="text" value="Jane Doe" id="fullname" name="member['fullname'][1]" readonly />
</fieldset>
<input type="submit" value="Send" />
</form>
And my php, make the following changes:
$values = array();
$i = 0;
foreach ($_POST['member'] as $member) {
$values[] = '(' . $member['shortname'][$i] . ',' . $member['fullname'][$i] . ')';
$i++;
}
<td class="text-left"><input type="text" class="form-control input-lg" name="expense[date][]" required placeholder="Enter Date (yy-mm-dd)"></td>
<td class="text-left"><input type="text" class="form-control input-lg" name="expense[msg][]" required placeholder="Enter Expenses Here"></td>
<td class="text-left"><input type="text" class="form-control input-lg" name="expense[vendor][]" required placeholder="Vendor Name Here"></td>
<td class="text-left"><input type="text" class="form-control input-lg" name="expense[amount][]" required placeholder="Enter Amount Here"></td>
<td class="text-left"><input type="text" class="form-control input-lg" name="expense[prove][]" required placeholder="Prove"></td>
PHP Code
<?php
if(isset($_POST['submit'])){
//$date = mysql_real_escape_string($_POST['date']);
//$date = strtotime($date);
// $date = date('Y-m-d', $date);
//$msg = mysql_real_escape_string($_POST['msg']);
//$vendor = mysql_real_escape_string($_POST['vendor']);
//$amount = mysql_real_escape_string($_POST['amount']);
//$prove = mysql_real_escape_string($_POST['prove']);
$values = array();
for($i=0 ;$i < count($_POST['expense']); $i++) {
$values[] = '("' . $_POST['expense']['date'][$i] . '","' . $_POST['expense']['msg'][$i] . '","' . $_POST['expense']['vendor'][$i] . '","' . $_POST['expense']['amount'][$i] . '","' . $_POST['expense']['prove'][$i] . '")';
}
$sql = ("INSERT INTO expenses (date, msg, vendor, amount, prove) VALUES " . implode(',', $values));
echo "<script>alert('Your expenses data inserted successfully!')</script>";
echo "<script>window.open('expenses.php','_self')</script>";
exit();
}
?>
show me the error Notice: Undefiened offset:2 in ..............

PHP Form will not post into my database

My PHP form will not post into the database. I understand php and mysql connections fairly well but I'm stumped on this one. When I hit submit on my form it doesn't echo the values that I(the user) put in. The date shows up as 1969-12-31, not the date the user submits. If anyone could help that would be great. My code is as follows
The form code is:
<form method="POST" action="add_event.php" id="create_event">
<label for="event_name">Event Name:</label>
<input type="text" id="event_name"><br />
<label for="date">Date:</label>
<input class="datepicker" type="date" id="date"><br />
<label for="zip_code">Zip Code:</label>
<input type="text" id="zip_code" maxlength="5"><br />
<label for="description">Description</label>
<textarea id="description" rows="5" columns="10"></textarea>
<br>
<input type="submit" name="submit">
</form>
The add_event.php insert code is:
<?php
require_once '../app_config.php';
require_once '../database_connection.php';
require_once '../authorize.php';
session_start();
// Authorize any user, as long as they're logged in
authorize_user();
//Get the user ID of the user to show
$user_id = $_SESSION['user_id'];
$select_query = "SELECT first_name, last_name FROM users WHERE user_id = " . $user_id;
// Run the query
$result = mysql_query($select_query);
if ($result) {
$row = mysql_fetch_array($result);
$first_name = $row['first_name'];
$last_name = $row['last_name'];
}
$name = $first_name . ' ' . $last_name;
$event_name = trim($_POST['event_name']);
$date = trim($_POST['date']);
$zip_code = trim($_POST['zip_code']);
$description = trim($_POST['description']);
// $date = "2012-08-22";
$newdate = date("Y-m-d", strtotime($date));
// $event_name = "test";
// $zip_code = "22153";
// $description = "test";
$insert_sql = sprintf("INSERT INTO events " .
"(name, user_profile_id, event_name, date, zip_code, description) " .
"VALUES ('%s', %d, '%s', '%s', '%s', '%s');",
mysql_real_escape_string($name),
mysql_real_escape_string($user_id),
mysql_real_escape_string($event_name),
mysql_real_escape_string($newdate),
mysql_real_escape_string($zip_code),
mysql_real_escape_string($description));
//insert the user into the database
mysql_query($insert_sql);
echo $insert_sql;
?>
Much thanks in advance.
The problem is that you are not naming your input fields. If you add the name property to the input in your html code the value will be stored in the $_POST array in php once the form is submitted. The correct html code should be:
<form method="POST" action="add_event.php" id="create_event">
<label for="event_name">Event Name:</label>
<input type="text" name="event_name"><br />
<label for="date">Date:</label>
<input class="datepicker" type="date" name="date"><br />
<label for="zip_code">Zip Code:</label>
<input type="text" name="zip_code" maxlength="5"><br />
<label for="description">Description</label>
<textarea name="description" rows="5" columns="10"></textarea>
<br>
<input type="submit" name="submit">
</form>
I am not sure if you needed the ids on the inputs for anything else, otherwise you should re-add those. For more information on html forms, visit: http://www.w3schools.com/html/html_forms.asp
You have not included any name attribute in your form. Here is how it should be:
<label for="event_name">Event Name:</label>
<input type="text" id="event_name" name="event_name"><br />
<label for="date">Date:</label>
<input class="datepicker" type="date" id="date" name="date"><br />
<label for="zip_code">Zip Code:</label>
<input type="text" id="zip_code" maxlength="5" name="zip_code"><br />
<label for="description">Description</label>
<textarea id="description" rows="5" columns="10" name="description"></textarea>
Note that only form inputs element that have the name attribute will be sent to the server. ID is only used on the client side.
Don't you need some name attributes in your form?
For example:
<input class="datepicker" type="date" id="date" name="date">
and the value within your POST['your_value'] must be the same as the value for the name attribute.
so:
$my_date = $_POST['date']
You need to give your input elements a name attribute... This is how php uses the $_POST['name attribute'] global to identify the field you are referring to.
so for example...
<form method="POST" action="add_event.php" id="create_event">
<label for="event_name">Event Name:</label>
<input type="text" name="event_name" id="event_name"><br />
<label for="date">Date:</label>
<input class="datepicker" name="date" type="date" id="date"><br />
<label for="zip_code">Zip Code:</label>
<input type="text" id="zip_code" name="zip_code" maxlength="5"><br />
<label for="description">Description</label>
<textarea id="description" name="description" rows="5" columns="10"></textarea>
<br>
<input type="submit" name="submit">
</form>

Categories