Need assistance with mysqli insert – PHP – SitePoint Boards

Hello, I hopd somebody will advise me as to the place I’m going astray right here. I’m attempting to insert utilizing PHP mysqli, utilizing a kind domestically <a href="https://www.sitepoint.com/group/t/need-help-with-mysqli-insert/410562/waitinsert-form.html">. Following is the code for the shape (is the shape flawed?) adopted by the code for the insert.
I’ve tried following a number of on-line examples with no success.

the code for the shape:

<HTML><HEAD>
<STYLE kind=textual content/css>.spotlight {
	BACKGROUND: #ff6699
}
.textual content {
	COLOR: #ffffff
}
.each {
	BACKGROUND: black; COLOR: white
}
</STYLE>

<STYLE>INPUT.bgyellow {
	BACKGROUND-COLOR: yellow
}
</STYLE></head>
<physique bgcolor="ccffff">
<b>Ready/transfers Listing enter kind<p>
<kind motion="waitinsert.php" identify=Kind methodology="put up">

        		
<label for="entrytype">Entrytype:</label>
            <enter kind="textual content" identify="entrytype" id="entrytype">
<SELECT identify=entrytype> 
<OPTION  class=spotlight worth=W>W
<OPTION  class=spotlight worth=T>T
</OPTION></SELECT><br>  
<label for="appl">appl:</label>
            <enter kind="textual content" identify="appl" id="appl"><br>
<label for="date">date:</label>
            <enter kind="textual content" identify="date" id="date"><br>
<label for="time">time:</label>
            <enter kind="textual content" identify="time" id="time"><br>
<label for="tenant">tenant:</label>
            <enter kind="textual content" identify="tenant" id="tenant"><br>
<label for="racegend">racegend:</label>
            <enter kind="textual content" identify="racegend" id="racegend">
<SELECT identify=racegend>
 <OPTION class=spotlight worth=1f chosen>White feminine
<OPTION class=spotlight worth=2f>Black feminine
<OPTION class=spotlight worth=3f>Asian feminine
<OPTION class=spotlight worth=4f>Indian feminine
<OPTION class=spotlight worth=5f>Hawaiian feminine
<OPTION class=spotlight worth=1m>White male
<OPTION class=spotlight worth=2m>Black male
<OPTION class=spotlight worth=3m>Asian male
<OPTION class=spotlight worth=4m>Indian male
<OPTION class=spotlight worth=5m>Hawaiian male
</OPTION></SELECT><BR>
<label for="ethnicity">ethnicity:</label>
            <enter kind="textual content" identify="ethnicity" id="ethnicity">
<SELECT identify=ethnicity> 
<OPTION class=spotlight worth=Y>Y
<OPTION class=spotlight worth=N chosen>N
</OPTION></SELECT><BR>
<label for="laborhsg">laborhsg:</label>
            <enter kind="textual content" identify="laborhsg" id="laborhsg">
<SELECT identify=laborhsg> 
<OPTION class=spotlight worth=Y>N
<OPTION class=spotlight worth=N chosen>X
</OPTION></SELECT><BR>
<label for="displ">displ:</label>
            <enter kind="textual content" identify="displ" id="displ">
<SELECT identify=displ> 			
<OPTION class=spotlight worth=Y>X
<OPTION class=spotlight worth=N chosen>N
</OPTION></SELECT><BR>
<label for="incomelevel">incomelevel:</label>
            <enter kind="textual content" identify="incomelevel" id="incomelevel">
 <SELECT identify=incomelevel> 
<OPTION class=spotlight worth=VL chosen>verylow
<OPTION class=spotlight worth=L>low
<OPTION class=spotlight worth=M>medium
</OPTION></SELECT> <BR>
<label for="brneeded">brneeded:</label>
            <enter kind="textual content" identify="brneeded" id="brneeded">
<SELECT identify=brneeded> 
<OPTION class=spotlight worth=1 chosen>1
<OPTION class=spotlight worth=2>2
<OPTION  class=spotlight worth=3>3
</OPTION></SELECT><BR>
<label for="moveindate">moveindate:</label>
            <enter kind="textual content" identify="moveindate" id="moveindate"><BR>
<label for="removaldate">removaldate:</label>
            <enter kind="textual content" identify="removaldate" id="removaldate"><BR>
<label for="code">code:</label>
            <enter kind="textual content" identify="code" id="code"><BR>
<label for="feedback">feedback:</label>
            <enter kind="textual content" identify="feedback" id="feedback"><BR>
<P>
<INPUT kind=submit worth="submit knowledge"><BR></FORM></B></BODY></HTML>

the code for insert:

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "homedb";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);

// Examine connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
  
     $entrytype = $_POST['entrytype'];
     $appl = $_POST['appl'];
     $date = $_POST['date'];
     $time = $_POST['time'];
     $tenant = $_POST['tenant'];
     $racegend = $_POST['racegend'];
     $ethnicity = $_POST['ethnicity'];
     $displ = $_POST['displ'];
     $compday = $_POST['compday'];
     $compmoyr = $_POST['compmoyr'];
     $incomelevel = $_POST['incomelevel'];
     $brneeded = $_POST['brneeded'];
     $moveindate = $_POST['moveindate'];
     $removaldate = $_POST['removaldate'];
     $code = $_POST['code'];
     $feedback = $_POST['comments'];
     $sql = "INSERT INTO waittbl (entrytype, appl, date, time, tenant, racegend, ethnicity, displ, 
compday, compmoyr, incomelevel, brneeded, moveindate, removaldate, code, feedback)
     VALUES ('$entrytype','$appl','$date','$time','$tenant','$racegend','$ethnicity','$displ',
'$compday','$compmoyr','$incomelevel','$brneeded','$moveindate','$removaldate','$code','$feedback')";
     if (mysqli_query($conn, $sql)) {
			echo "New file created efficiently".'<br>';
		} else {
		echo "Error: " . $sql. "<br>" . mysqli_error($conn);
	}
}
?>

the end result:

'; } else { echo "Error: " . $sql. "
" . mysqli_error($conn); } } ?>

Source link

Add a Comment

Your email address will not be published. Required fields are marked *