/    Sign up×
Community /Pin to ProfileBookmark

Why ISSET Gives False Echoe ?

Folks,

I programmed the code so at page load I get echoed as expected: Did Not REQUEST_METHOD!

Then, I click the SUBMIT button and to my astonishment I get echoed: Did Not POST->Submit!

For some reason, php is unable to detect clicks to these 2 buttons:

[code]
<button type=”submit” value=”submit”>Submit</button><br>
<button type=”submit”>Submit</button>
[/code]

How to fix this ? How to get php to check if them 2 buttons got clicked or not ? Anyway, I coded it like this ….

(Got 2 buttons. Same result whenever clicking any).

[code]

<?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” value=”submit”>Submit</button><br>
<button type=”submit”>Submit</button>
<br>
<input type=”reset”>
<br>
</form>

<?php

if($_SERVER[‘REQUEST_METHOD’] === ‘POST’)
{
if(isset($_POST[‘submit’]))
{
mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT);
mysqli_connect(“localhost”,”root”,””,”test”);
$conn->set_charset(“utf8mb4”);

$query = “INSERT into links (domain,domain_email,url,link_anchor_text,page_description,keywords,alert_visitor_type,alert_visitor_potential) VALUES (?,?,?,?,?,?,?,?)”;

$stmt = mysqli_stmt_init($conn);

if(mysqli_stmt_prepare($stmt,$query))
{
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’]);
if(mysqli_stmt_execute($stmt) === FALSE)
{
die(“Error” . mysqli_stmt_error()”);
}

mysqli_stmt_close($stmt);
mysqli_close($conn);
}
else
{
die(“Did not INSERT!”);
}
}
else
{
die(“Did Not POST->Submit!”);
}
}
else
{
die(“Did Not REQUEST_METHOD!”);
}

?>

[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@daveyerwinJul 17.2020 — you did not give the submit buttons a name

you absolutely must learn HTML Forms

before you begin to send data to server
Copy linkTweet thisAlerts:
@VITSUSAJul 20.2020 — I agree with DaveyErwin, Have you learn about HTML forms?
×

Success!

Help @developer_web spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...