Passing to php
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I am trying to make a QR code scanner using Vue.js and instascan. I have already done the scanning part. Now I am stuck in this process where I have to retrieve the data from MySQL using an Ajax request. I can't seem to retrieve the data from the input form.
Here is my HTML code:
<form id="cont_disp" method="post">
<label class="disptext" style="margin-left: 41%;">Load user credits</label>
<div class="form-group" id="app">
<input v-for="scan in scans" :key="scan.date" hidden :title="scan.content" class="form-control" id="qr_user" name="qr_user" placeholder="Scan User QR Code":value="scan.content" style="width: 15%; font-size: 20px; left: 44%; position: absolute; top: 30%; border: 0; background: transparent;">
</div>
<div class="video-container">
<video id="preview"></video>
</div>
<div class="content-display">
<label class="disptext" style="font-size: 20px;">Username: </label>
<input type="button" name="" class="login" value="Search" style="margin-left: 70%; font-size: 20px;" id="qr_search">
<br /><br />
<label class="disptext" style="font-size: 20px;">Current Balance: </label><input type="text" class="disptext" id="userbal" style="font-size: 20px; left: 44%;"><br /><br />
<label class="disptext" style="font-size: 20px;">Enter credit amount: </label><input type="number" name="loadcred" id="loadcred" style="margin-left: 28%;" required placeholder="Credit amount"><br /><br />
<input type="submit" name="credsub" id="credsub" value="Load Credits" class="login" style="width: 50%; margin-top: 3%;">
</div>
</form>
And here is the php query.
include 'dbcon.php';
$qr_user = $_POST['qr_user'];
$query = mysqli_query($con, "SELECT username, credits FROM useracc WHERE username='$qr_user'");
$row = mysqli_fetch_array($query);
echo json_encode($row);
And the Ajax request:
$("#qr_search").click(function(){
var qr_user = $("#qr_user").val();
$.ajax({
type: "post",
url: "../Capstone/qrdata.php",
data: formData = {username:qr_user},
success: function(data){
// can't seem to do anything here since I can't fetch any data from php
}
});
});
javascript php ajax vue.js
add a comment |
I am trying to make a QR code scanner using Vue.js and instascan. I have already done the scanning part. Now I am stuck in this process where I have to retrieve the data from MySQL using an Ajax request. I can't seem to retrieve the data from the input form.
Here is my HTML code:
<form id="cont_disp" method="post">
<label class="disptext" style="margin-left: 41%;">Load user credits</label>
<div class="form-group" id="app">
<input v-for="scan in scans" :key="scan.date" hidden :title="scan.content" class="form-control" id="qr_user" name="qr_user" placeholder="Scan User QR Code":value="scan.content" style="width: 15%; font-size: 20px; left: 44%; position: absolute; top: 30%; border: 0; background: transparent;">
</div>
<div class="video-container">
<video id="preview"></video>
</div>
<div class="content-display">
<label class="disptext" style="font-size: 20px;">Username: </label>
<input type="button" name="" class="login" value="Search" style="margin-left: 70%; font-size: 20px;" id="qr_search">
<br /><br />
<label class="disptext" style="font-size: 20px;">Current Balance: </label><input type="text" class="disptext" id="userbal" style="font-size: 20px; left: 44%;"><br /><br />
<label class="disptext" style="font-size: 20px;">Enter credit amount: </label><input type="number" name="loadcred" id="loadcred" style="margin-left: 28%;" required placeholder="Credit amount"><br /><br />
<input type="submit" name="credsub" id="credsub" value="Load Credits" class="login" style="width: 50%; margin-top: 3%;">
</div>
</form>
And here is the php query.
include 'dbcon.php';
$qr_user = $_POST['qr_user'];
$query = mysqli_query($con, "SELECT username, credits FROM useracc WHERE username='$qr_user'");
$row = mysqli_fetch_array($query);
echo json_encode($row);
And the Ajax request:
$("#qr_search").click(function(){
var qr_user = $("#qr_user").val();
$.ajax({
type: "post",
url: "../Capstone/qrdata.php",
data: formData = {username:qr_user},
success: function(data){
// can't seem to do anything here since I can't fetch any data from php
}
});
});
javascript php ajax vue.js
add a comment |
I am trying to make a QR code scanner using Vue.js and instascan. I have already done the scanning part. Now I am stuck in this process where I have to retrieve the data from MySQL using an Ajax request. I can't seem to retrieve the data from the input form.
Here is my HTML code:
<form id="cont_disp" method="post">
<label class="disptext" style="margin-left: 41%;">Load user credits</label>
<div class="form-group" id="app">
<input v-for="scan in scans" :key="scan.date" hidden :title="scan.content" class="form-control" id="qr_user" name="qr_user" placeholder="Scan User QR Code":value="scan.content" style="width: 15%; font-size: 20px; left: 44%; position: absolute; top: 30%; border: 0; background: transparent;">
</div>
<div class="video-container">
<video id="preview"></video>
</div>
<div class="content-display">
<label class="disptext" style="font-size: 20px;">Username: </label>
<input type="button" name="" class="login" value="Search" style="margin-left: 70%; font-size: 20px;" id="qr_search">
<br /><br />
<label class="disptext" style="font-size: 20px;">Current Balance: </label><input type="text" class="disptext" id="userbal" style="font-size: 20px; left: 44%;"><br /><br />
<label class="disptext" style="font-size: 20px;">Enter credit amount: </label><input type="number" name="loadcred" id="loadcred" style="margin-left: 28%;" required placeholder="Credit amount"><br /><br />
<input type="submit" name="credsub" id="credsub" value="Load Credits" class="login" style="width: 50%; margin-top: 3%;">
</div>
</form>
And here is the php query.
include 'dbcon.php';
$qr_user = $_POST['qr_user'];
$query = mysqli_query($con, "SELECT username, credits FROM useracc WHERE username='$qr_user'");
$row = mysqli_fetch_array($query);
echo json_encode($row);
And the Ajax request:
$("#qr_search").click(function(){
var qr_user = $("#qr_user").val();
$.ajax({
type: "post",
url: "../Capstone/qrdata.php",
data: formData = {username:qr_user},
success: function(data){
// can't seem to do anything here since I can't fetch any data from php
}
});
});
javascript php ajax vue.js
I am trying to make a QR code scanner using Vue.js and instascan. I have already done the scanning part. Now I am stuck in this process where I have to retrieve the data from MySQL using an Ajax request. I can't seem to retrieve the data from the input form.
Here is my HTML code:
<form id="cont_disp" method="post">
<label class="disptext" style="margin-left: 41%;">Load user credits</label>
<div class="form-group" id="app">
<input v-for="scan in scans" :key="scan.date" hidden :title="scan.content" class="form-control" id="qr_user" name="qr_user" placeholder="Scan User QR Code":value="scan.content" style="width: 15%; font-size: 20px; left: 44%; position: absolute; top: 30%; border: 0; background: transparent;">
</div>
<div class="video-container">
<video id="preview"></video>
</div>
<div class="content-display">
<label class="disptext" style="font-size: 20px;">Username: </label>
<input type="button" name="" class="login" value="Search" style="margin-left: 70%; font-size: 20px;" id="qr_search">
<br /><br />
<label class="disptext" style="font-size: 20px;">Current Balance: </label><input type="text" class="disptext" id="userbal" style="font-size: 20px; left: 44%;"><br /><br />
<label class="disptext" style="font-size: 20px;">Enter credit amount: </label><input type="number" name="loadcred" id="loadcred" style="margin-left: 28%;" required placeholder="Credit amount"><br /><br />
<input type="submit" name="credsub" id="credsub" value="Load Credits" class="login" style="width: 50%; margin-top: 3%;">
</div>
</form>
And here is the php query.
include 'dbcon.php';
$qr_user = $_POST['qr_user'];
$query = mysqli_query($con, "SELECT username, credits FROM useracc WHERE username='$qr_user'");
$row = mysqli_fetch_array($query);
echo json_encode($row);
And the Ajax request:
$("#qr_search").click(function(){
var qr_user = $("#qr_user").val();
$.ajax({
type: "post",
url: "../Capstone/qrdata.php",
data: formData = {username:qr_user},
success: function(data){
// can't seem to do anything here since I can't fetch any data from php
}
});
});
javascript php ajax vue.js
javascript php ajax vue.js
edited Nov 24 '18 at 7:29
Billal Begueradj
6,083132950
6,083132950
asked Nov 24 '18 at 7:15
Gelo ManaloGelo Manalo
183
183
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Change this:
$qr_user = $_POST['qr_user'];
to:
$qr_user = $_POST['username'];
to solve the issue because the name is mismatched.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456040%2fpassing-input-v-for-to-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Change this:
$qr_user = $_POST['qr_user'];
to:
$qr_user = $_POST['username'];
to solve the issue because the name is mismatched.
add a comment |
Change this:
$qr_user = $_POST['qr_user'];
to:
$qr_user = $_POST['username'];
to solve the issue because the name is mismatched.
add a comment |
Change this:
$qr_user = $_POST['qr_user'];
to:
$qr_user = $_POST['username'];
to solve the issue because the name is mismatched.
Change this:
$qr_user = $_POST['qr_user'];
to:
$qr_user = $_POST['username'];
to solve the issue because the name is mismatched.
edited Nov 24 '18 at 7:30
Billal Begueradj
6,083132950
6,083132950
answered Nov 24 '18 at 7:25
RBTRBT
36715
36715
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456040%2fpassing-input-v-for-to-php%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown