Folks,
Why this code fails to INSERT ? I get no response after I click button.
[code]
<?php
include(‘error_reporting.php’);
require(‘conn.php’);
//equire(‘link_submission_form.php’);
?>
<form name = “submit_link” method = “POST” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”>
<label for=”domain”>Domain:</label>
<input type=”text” name=”domain” id=”domain” placeholder=”Input Domain”>
<br>
<label for=”domain_email”>Domain Email:</label>
<input type=”email” name=”domain_email” id=”domain_email” placeholder=”Input Domain Email”>
<br>
<label for=”url”>Url:</label>
<input type=”url” name=”url” id=”url” placeholder=”Input Url”>
<br>
<label for=”link_anchor_text”>Link Anchor Text:</label>
<input type=”text” name=”link_anchor_text” id=”link_anchor_text” placeholder=”Input Link Anchor Text”>
<br>
<textarea rows=”10″ cols=”20″>Page Description</textarea>
<br>
<label for=”keywords”>Keywords:</label>
<input type=”text” name=”keywords” id=”keywords” placeholder=”Input Keywords related to Page”>
<br>
<label for=”tos_agreement”>Agree to TOS or not ?</label>
<select name=”tos_agreement” id=”tos_agreement”>
<option value=”yes”>Yes</option>
<option value=”no”>No</option>
</select>
<br>
<input type=”button” name=”submit_link” id=”submit_link” value=”Submit Link!”>
<br>
<input type=”reset”>
<br>
</form>
<?php
if($_SERVER[‘REQUEST_METHOD’] === ‘POST’)
{
if(ISSET($_POST[‘submit_link’]))
{
$query = “INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords) VALUES ?,?,?,?,?,?”;
$stmt = mysqli_stmt_init($conn);
if(mysqli_stmt_prepare($stmt,$query))
{
mysqli_stmt_bind_param($stmt,’ssssss’,$_POST[‘domain’],$_POST[‘domain_email’],$_POST[‘url’],$_POST[‘link_anchor_text’],$_POST[‘page_description’],$_POST[‘keywords’]);
mysqli_stmt_close($stmt);
mysqli_close($conn);
}
else
{
die(“INSERT failed!”);
}
}
}
?>
<i>
</i><?php
ini_set('error_reporting','E_ALL');//Same as: error_reporting(E_ALL);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
?>
<form name = "submit_link" method = "POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="domain">Domain:</label>
<input type="text" name="domain" id="domain" placeholder="Input Domain">
<br>
<label for="domain_email">Domain Email:</label>
<input type="email" name="domain_email" id="domain_email" placeholder="Input Domain Email">
<br>
<label for="url">Url:</label>
<input type="url" name="url" id="url" placeholder="Input Url">
<br>
<label for="link_anchor_text">Link Anchor Text:</label>
<input type="text" name="link_anchor_text" id="link_anchor_text" placeholder="Input Link Anchor Text">
<br>
<textarea rows="10" cols="20">Page Description</textarea>
<br>
<label for="keywords">Keywords:</label>
<input type="text" name="keywords" id="keywords" placeholder="Input Keywords related to Page">
<br>
<input type="button" value="submit!">
<br>
<input type="reset">
<br>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
if(ISSET($_POST['submit_link']))
{
mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT);
mysqli_connect("localhost","root","","links");
$conn->set_charset("utf8mb4");
<i> </i> if(mysqli_connect_error())
<i> </i> {
<i> </i> echo "Could not connect!" . mysqli_connect_error();
<i> </i> }
<i> </i>
<i> </i> $query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords) VALUES ?,?,?,?,?,?";
<i> </i> $stmt = mysqli_stmt_init($conn);
<i> </i> if(mysqli_stmt_prepare($stmt,$query))
<i> </i> {
<i> </i> mysqli_stmt_bind_param($stmt,'ssssss',$_POST['domain'],$_POST['domain_email'],$_POST['url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keywords']);
<i> </i> mysqli_stmt_execute($stmt);
<i> </i>
<i> </i> mysqli_stmt_close($stmt);
<i> </i> mysqli_close($conn);
<i> </i> }
<i> </i> else
<i> </i> {
<i> </i> die("INSERT failed!");
<i> </i> }
<i> </i>}
}
?>
>@developer_web#1620673 mysqli_connect("localhost","root","","links");
<i>
</i>$query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES ?,?,?,?,?,?,?,?";
[
<i>
</i>$query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
[
<i>
</i>mysqli_connect("localhost","root","","test");
<i>
</i>$query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
<i>
</i>$query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES ?,?,?,?,?,?,?,?";
<i>
</i>$query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
<i>
</i><?php
//include('error_reporting.php');
ini_set('error_reporting','E_ALL');//Same as: error_reporting(E_ALL);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
?>
<form name = "submit_link" method = "POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="domain">Domain:</label>
<input type="text" name="domain" id="domain" placeholder="Input Domain">
<br>
<label for="domain_email">Domain Email:</label>
<input type="email" name="domain_email" id="domain_email" placeholder="Input Domain Email">
<br>
<label for="url">Url:</label>
<input type="url" name="url" id="url" placeholder="Input Url">
<br>
<label for="link_anchor_text">Link Anchor Text:</label>
<input type="text" name="link_anchor_text" id="link_anchor_text" placeholder="Input Link Anchor Text">
<br>
<textarea rows="10" cols="20">Page Description</textarea>
<br>
<label for="keywords">Keywords:</label>
<input type="text" name="keywords" id="keywords" placeholder="Input Keywords related to Page">
<br>
<input type="checkbox" name="alert_visitor_type" id="alert_visitor_type" value="Give Alert: Visitor Type">
</label for="alert_visitor_type">Give Alert: Visitor Type</lablel>
<input type="checkbox" name="alert_visitor_potential" id="alert_visitor_potential" value="Give Alert: Potential Visitor">
</label for="alert_visitor_potential">Give Alert: Potential Visitor</lablel>
<br>
<input type="radio" name="tos_agree" id="tos_agree_yes" value="yes">
<label for="tos_agree_yes">Yes:</label>
<input type="radio" name="tos_agree" id="tos_agree_no" value="no">
<label for="tos_agree_no">No:</label>
<br>
<label for="tos_agreement">Agree to TOS or not ?</label>
<select name="tos_agreement" id="tos_agreement">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br>
<button type="submit">Click me</button>
<br>
<input type="reset">
<br>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
/*
if(ISSET($_POST['submit_link']))
{*/
mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT);
mysqli_connect("localhost","root","","test");
$conn->set_charset("utf8mb4");
<i> </i> if(mysqli_connect_error())
<i> </i> {
<i> </i> echo "Could not connect!" . mysqli_connect_error();
<i> </i> }
<i> </i>
<i> </i> $query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
<i> </i> $stmt = mysqli_stmt_init($conn);
<i> </i> if(mysqli_stmt_prepare($stmt,$query))
<i> </i> {
<i> </i> mysqli_stmt_bind_param($stmt,'ssssssss',$_POST['domain'],$_POST['domain_email'],$_POST['url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keywords'],$_POST['alert_visitor_type'],$_POST['alert_visitor_potential']);
<i> </i> mysqli_stmt_execute($stmt);
<i> </i>
<i> </i> mysqli_stmt_close($stmt);
<i> </i> mysqli_close($conn);
<i> </i> }
<i> </i> else
<i> </i> {
<i> </i> die("INSERT failed!");
<i> </i> }
<i> </i>//}
}
?>
<i>
</i>
<form name = "submit_link" method = "POST" action="">
<i>
</i><?php
//include('error_reporting.php');
ini_set('error_reporting','E_ALL');//Same as: error_reporting(E_ALL);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
?>
<form name = "submit_link" method = "POST" action="">
<label for="domain">Domain:</label>
<input type="text" name="domain" id="domain" placeholder="Input Domain">
<br>
<label for="domain_email">Domain Email:</label>
<input type="email" name="domain_email" id="domain_email" placeholder="Input Domain Email">
<br>
<label for="url">Url:</label>
<input type="url" name="url" id="url" placeholder="Input Url">
<br>
<label for="link_anchor_text">Link Anchor Text:</label>
<input type="text" name="link_anchor_text" id="link_anchor_text" placeholder="Input Link Anchor Text">
<br>
<textarea rows="10" cols="20">Page Description</textarea>
<br>
<label for="keywords">Keywords:</label>
<input type="text" name="keywords" id="keywords" placeholder="Input Keywords related to Page">
<br>
<input type="checkbox" name="alert_visitor_type" id="alert_visitor_type" value="Give Alert: Visitor Type">
</label for="alert_visitor_type">Give Alert: Visitor Type</lablel>
<input type="checkbox" name="alert_visitor_potential" id="alert_visitor_potential" value="Give Alert: Potential Visitor">
</label for="alert_visitor_potential">Give Alert: Potential Visitor</lablel>
<br>
<input type="radio" name="tos_agree" id="tos_agree_yes" value="yes">
<label for="tos_agree_yes">Yes:</label>
<input type="radio" name="tos_agree" id="tos_agree_no" value="no">
<label for="tos_agree_no">No:</label>
<br>
<label for="tos_agreement">Agree to TOS or not ?</label>
<select name="tos_agreement" id="tos_agreement">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br>
<button type="submit">Click me</button>
<br>
<input type="reset">
<br>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
/*
if(ISSET($_POST['submit_link']))
{*/
mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT);
mysqli_connect("localhost","root","","test");
$conn->set_charset("utf8mb4");
<i> </i> if(mysqli_connect_error())
<i> </i> {
<i> </i> echo "Could not connect!" . mysqli_connect_error();
<i> </i> }
<i> </i>
<i> </i> $query = "INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
<i> </i> $stmt = mysqli_stmt_init($conn);
<i> </i> if(mysqli_stmt_prepare($stmt,$query))
<i> </i> {
<i> </i> mysqli_stmt_bind_param($stmt,'ssssssss',$_POST['domain'],$_POST['domain_email'],$_POST['url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keywords'],$_POST['alert_visitor_type'],$_POST['alert_visitor_potential']);
<i> </i> mysqli_stmt_execute($stmt);
<i> </i>
<i> </i> mysqli_stmt_close($stmt);
<i> </i> mysqli_close($conn);
<i> </i> }
<i> </i> else
<i> </i> {
<i> </i> die("INSERT failed!");
<i> </i> }
<i> </i>//}
}
?>
``<i>
</i><?php
//include('error_reporting.php');
ini_set('error_reporting','E_ALL');//Same as: error_reporting(E_ALL);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
?>
<form method = "POST" action="">
<label for="keywords">Keywords:*</label>
<input type="text" name="keywords" id="keywords" placeholder="Input Keywords" required>
<br>
<button name=search_links value=" ">send</button>
<br>
<input type="reset">
<br>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
if(ISSET($_POST['search_links']))
{
if(ISSET($_POST['keywords']))
{
$keywords = $_POST['keywords'];
}
$servername = "localhost";
$username = "x-x-x-x-x-x-x-";
$password = "x-x--x-x--x-x";
$dbname = "x-x-x-x-x-x-x-x-";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: ");
}
$sql = "CREATE TABLE IF NOT EXISTS Test (
link VARCHAR(255) NOT NULL
) ";
if($result=mysqli_query($conn, $sql)){
echo 'table created successfully<br>';
}
else {
echo 'Error creating table<br>' ;
}
$sql = "INSERT into Test (link) VALUES (?)";
$stmt = mysqli_stmt_init($conn);
mysqli_stmt_prepare($stmt,$sql);
mysqli_stmt_bind_param($stmt, "s", $keywords);
mysqli_stmt_execute($stmt);
$sql = "SELECT * FROM Test";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_array($result)) {
echo $row[0]. "<br>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
}}
?><i>
</i>
``
<i>
</i><?php
//include('error_reporting.php');
ini_set('error_reporting',E_ALL);//Same as: error_reporting(E_ALL);
ini_set('display_errors','1');
ini_set('display_startup_errors','1');
?>
<form name = "submit" method = "POST" action="">
<label for="domain">Domain:</label>
<input type="text" name="domain" id="domain" placeholder="Input Domain">
<br>
<label for="domain_email">Domain Email:</label>
<input type="email" name="domain_email" id="domain_email" placeholder="Input Domain Email">
<br>
<label for="url">Url:</label>
<input type="url" name="url" id="url" placeholder="Input Url">
<br>
<label for="link_anchor_text">Link Anchor Text:</label>
<input type="text" name="link_anchor_text" id="link_anchor_text" placeholder="Input Link Anchor Text">
<br>
<textarea rows="10" cols="20">Page Description</textarea>
<br>
<label for="keywords">Keywords:</label>
<input type="text" name="keywords" id="keywords" placeholder="Input Keywords related to Page">
<br>
<input type="checkbox" name="alert_visitor_type" id="alert_visitor_type" value="Give Alert: Visitor Type">
</label for="alert_visitor_type">Give Alert: Visitor Type</lablel>
<input type="checkbox" name="alert_visitor_potential" id="alert_visitor_potential" value="Give Alert: Potential Visitor">
</label for="alert_visitor_potential">Give Alert: Potential Visitor</lablel>
<br>
<input type="radio" name="tos_agree" id="tos_agree_yes" value="yes">
<label for="tos_agree_yes">Yes:</label>
<input type="radio" name="tos_agree" id="tos_agree_no" value="no">
<label for="tos_agree_no">No:</label>
<br>
<label for="tos_agreement">Agree to TOS or not ?</label>
<select name="tos_agreement" id="tos_agreement">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br>
<button type="submit">Submit</button>
<button type="submit" value="submit">Submit</button>
<input type="submit" value="submit">
<button name=submit value=" ">Submit</button>
<br>
<input type="reset">
<br>
</form>
<?php
if($_SERVER['REQUEST_METHOD'] === 'POST')
{
if(isset($_POST['submit']))
{
//Re-write the following 4 lines ...
mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT);
$conn = mysqli_connect("localhost","root","","test");
$conn->set_charset("utf8mb4");
<i> </i> $query = "INSERT into links (domain,domain_email,page_url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)";
<i> </i> $stmt = mysqli_stmt_init($conn);
<i> </i> if(mysqli_stmt_prepare($stmt,$query))
<i> </i> {
<i> </i> mysqli_stmt_bind_param($stmt,'ssssssss',$_POST['domain'],$_POST['domain_email'],$_POST['url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keywords'],$_POST['alert_visitor_type'],$_POST['alert_visitor_potential']);
<i> </i> if(mysqli_stmt_execute($stmt) === FALSE)
<i> </i> {
<i> </i> printf("Error: %s.n", mysqli_stmt_error($stmt));
<i> </i> printf("Error: %d.n", mysqli_stmt_errno($stmt));
<i> </i> }
<i> </i>
<i> </i> mysqli_stmt_close($stmt);
<i> </i> mysqli_close($conn);
<i> </i> }
<i> </i> else
<i> </i> {
<i> </i> die("Did not INSERT!");
<i> </i> }
<i> </i>}
<i> </i>else
<i> </i>{
<i> </i> die("Did Not POST->Submit!");
<i> </i>}
}
else
{
die("Did Not REQUEST_METHOD!");
}
?>
0.1.9 — BETA 6.16