Supplement Genie
Forum Replies Created
-
@codersantosh if I chose to use the image as a normal image this then does not display correctly as a header image which I am trying to use the block for.
Is there a better block to use as a header image block that might do what I am trying to achieve?
@wpmudev-support9 I sorted the problem. I hade removed jquery.js from the exception list as it was shown as render-blocking.
But it appears that it does not work correctly if combined and minified so when I re0added it, the forms worked fine.
Forum: Plugins
In reply to: [Autoptimize] Gutenberg Google maps not loadingBrilliant, the problem appears to be sorted ??
Forum: Plugins
In reply to: [Autoptimize] Gutenberg Google maps not loadingMy current Exception list is:
wp-includes/js/dist/, wp-includes/js/tinymce/, plugins/gutentor/assets/js/google-map-loader.min.js, plugins/gutentor/assets/js/google-map-loader.js
I have also noticed that forminator – contact form doesnt load either and seems to be given an element style of display:none;
Forum: Plugins
In reply to: [Autoptimize] Gutenberg Google maps not loadingah… Got it ??
I added
plugins/gutentor/assets/js/google-map-loader.min.js, plugins/gutentor/assets/js/google-map-loader.js
To the exceptions, sorry if that is what you meant
Forum: Plugins
In reply to: [Autoptimize] Gutenberg Google maps not loading@optimizingmatters I tried that but it had no effect, the maps block still does not show.
Forum: Plugins
In reply to: [Autoptimize] Gutenberg Google maps not loadingIf I add that to the exceptions, would that not then leave all gutentor blocks from being cached and as a result negate the need for this plugin?
Forum: Fixing WordPress
In reply to: Adding custom fields to PluginI am thinking, from looking that it has something to do with one of these files:
https://github.com/wp-invoice/wp-invoice/blob/latest/lib/class_template_functions.php
https://github.com/wp-invoice/wp-invoice/blob/latest/lib/class_functions.php
https://github.com/wp-invoice/wp-invoice/blob/latest/lib/class_ajax.php
Forum: Fixing WordPress
In reply to: Adding custom fields to Plugin@a2hostingrj I think the PDF will be the easy part.
However, I need to add a new field to the admin end of the plug in so that I can insert the PO number. Currently When I add an invoice, there is no option for this
I have mainly done front end development so not sure how to add new fields to a plugin?
Forum: Fixing WordPress
In reply to: Unable to access wp-admin@macmanx thank you for your reply.
I have tried doing the above. I have even set my website back to yesterdays settings. the website worked fine earlier today and assumed that if I regressed to yestersay that it should be fine but it done nothing
Forum: Developing with WordPress
In reply to: Saving data from form to Database Table@joyously @bcworkz Thank you for the help. The form is intended to be used internally and only logged-in users within the company will have access so im hoping that security won’t be an issue.
Can I ask, I have tried a number of different things but apparently none of them being the right thing.
based on the code, I have… After form submission, I am keen for the form to be cleared however as it stands, once submitted, all of the form fields remain populated.
The jQuery/Ajax, passes all the details over for PHP to process so I am thinking that PHP will be the better place to put the code…
I have tried adding at the end:
echo:"<script></script>"
and putting different code in after the
if (mysqli_query($conn, $sql)) { echo "New record created successfully"; }
as well as after the ajax:
success: function() { alert('Message sent'); document.getElementById('dataForm').reset(); }
Is there a better way to do this that might actually work? lol
Update…
Solved the problem..
success: function() { alert('Message sent'); }, complete: function(){ $('#dataForm').each(function(){ this.reset(); //Here form fields will be cleared. }); }
The bit that I cant get to clear is the
<select>
areas, they remain populated. however if I fill in the other areas and then press submit, although they have values in them, the script doesn’t recognsise that theyre there so I need to clear the values myself and re-enter- This reply was modified 5 years, 2 months ago by Supplement Genie.
- This reply was modified 5 years, 2 months ago by Supplement Genie.
- This reply was modified 5 years, 2 months ago by Supplement Genie.
- This reply was modified 5 years, 2 months ago by Supplement Genie.
Forum: Developing with WordPress
In reply to: Saving data from form to Database Table@joyously
Simple fix, thank you, thats it working now ??In all honesty in the few replies youve given me you have been a massive help… You have helped me to also see that when I am debugging I spend too much time looking at the code and what it is saying as above, my code seemed to have all the right info etc… I dont spend enough time looking at the other details such as punctuation which can have a massive effect on the code.
I looked at that over and over and never noticed the missing
,
Thank you again and sorry for my negligence ?? lol
Forum: Developing with WordPress
In reply to: Saving data from form to Database Table@joyously @bcworkz yeah the mysqli was misspelt but I amended that earleir, not that it made any difference lol.
I now have error messages showing…
Have done a bit of tinkering and the error message I am getting:
Error: INSERT INTO
add_job(
id,
adddate,
addcontact,
adda,
addb,
addincome,
addpayment,
addsubbie,
addclient`) VALUES (NULL ‘2019-09-06’, ‘test’, ‘test’, ‘test’, ‘test’, ‘test’, ‘test’, ”)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”2019-09-06′, ‘test’, ‘test’, ‘test’, ‘test’, ‘test’, ‘test’, ”)’ at line 2`I have changed to code to:
JS
jQuery(document).ready(function () { $("#addsubmit").click(function(e) { e.preventDefault(); e.stopPropagation(); var date = document.getElementById("adddate").value; var contact = document.getElementById("addcontact").value; var a = document.getElementById("adda).value; var b = document.getElementById("addb").value; var income = document.getElementById("addincome").value; var payment = document.getElementById("adddate").value; var subbie = document.getElementById("addsubbie").value; var client = document.getElementById("addclient").value; // Returns successful data submission message when the entered information is stored in database. var dataForm = 'date1=' + date + '&contact1=' + contact + '&a1=' + a + '&b1=' + b + '&income1=' + income + '&payment1=' + payment + '&subbie1=' + subbie + '&client1=' + client; if (date == '' || contact == '' || a == '' || b == '' || income == '' || payment == '' || subbie == '' || client == '') { alert("Please Fill All Fields"); } else { // AJAX code to submit form. jQuery.ajax({ type: "POST", url: 'wp-content/themes/EazyFreight/database.php', data: dataForm, dataType:"json", success:function(strMessage) { $("#message").text(strMessage); $("#dataForm")[0].reset(); } }); return false; } });
PHP
<?php //Register variables $adddate = $_POST['date1']; $addcontact = $_POST['contact1']; $adda = $_POST['a1']; $addb = $_POST['b1']; $addincome = $_POST['income1']; $addpayment = $_POST['payment1']; $addsubbie = $_POST['subbie1']; $addclient = $POST['client1']; //connect with Database if (!empty($adddate) || !empty($addcontact) || !empty($adda) || !empty($addb) || !empty($addincome) || !empty($addpayment) || !empty($addsubbie) || !empty($addclient)){ $host_name = 'xxx.hosting-data.io'; $database = 'xxx'; $user_name = 'xxx'; $password = 'xxx'; $conn = mysqli_connect($host_name, $user_name, $password, $database); } // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO <code>add_job</code>(<code>id</code>, <code>adddate</code>, <code>addcontact</code>, <code>adda</code>, <code>addb</code>, <code>addincome</code>, <code>addpayment</code>, <code>addsubbie</code>, <code>addclient</code>) VALUES (NULL '$adddate', '$addcontact', '$adda', '$addb', '$addincome', '$addpayment', '$addsubbie', '$addclient')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } mysqli_close($conn); die();
Have you any idea what might cause the error? or the best way to deb
Forum: Developing with WordPress
In reply to: Saving data from form to Database Table@joyously @bcworkz yeah the mysqli was misspelt but I amended that earleir, not that it made any difference lol.
no the way it was shown in the question was wrong, I tried to edit but was too late. I had added ” to the terms in the brackets on the lower one but all it done was add grey areas lol… And this is one big grey area for me
I feel as though I have used the correct code I cannot see anything that I should change.
But I am unsure how to determine what is causing the error.When I check console and params, it gives all the right parameters with the correct titles.
But the php doesnt seem to take them and insert them into the table. I am unsure how to debug this as the echo statements I have added dont seem to work which makes it harder to determine where the error lies
Forum: Developing with WordPress
In reply to: Saving data from form to Database Table@bcworkz
Hopefully you or someone can help with this final thing. I have tried ammending based on what I have seen online but with no joy.I have the ajax sending to the correct file, everything seems to be going great, however, the database table is not being populated…
The code I am using for the table is as before:
<div class="addjob tab-pane show active" id="home" role="tabpanel" aria-labelledby="home-tab"> <h2>Add Job</h2> <form id="dataForm" name="dataform" method="POST" action=""> <span> <label>Job Date:</label> <input class="add-date" type="date" placeholder="Placeholder Text" name="adddate"> </span> <span> <label>Client Name:</label> <select name="addclient" class="limitedNumbChosen add-client" multiple="false"> <option value="1">ClientA</option> <option value="2">ClientB</option> </select> <div id="add-client" class="fas fa-plus"> Add New Client</div> </span> <span> <label>Contact Name:</label> <input class="add-contact" type="text" placeholder="John Doe"name="addcontact"> </span> <span> <label>a:</label> <input id="add_a" class="add-from" type="text" placeholder="Postcode from" name="adda"> </span> <span> <label>b:</label> <input class="add-b" type="text" placeholder="Postcode to" name="addb"> </span> <span> <label>Who Done Job:</label> <select name="addsubbie" class="limitedNumbSelect2 add-subbie" multiple="true"> <option value="1">Dave</option> </select> <div id="add-subbie" class="fas fa-plus"> Add Subbie </div> </span> <span> <label>Income (£):</label> <input class="add-income" type="number" placeholder="£120" name="addincome"> </span> <span> <label>Driver Payment (£):</label> <input class="add-payment" type="number" placeholder="£100" name="addpayment"> </span> <span> <button id="submit" type="submit" value="submit">Submit</button> </span> </form> </div>
The PHP used in database.php (which the ajax calls)
<?php function so56917978_upload_callback() { //Register variables $adddate = $_POST['adddate']; $addcontact = $_POST['addcontact']; $adda = $_POST['adda ']; $addb = $_POST['addb']; $addincome = $_POST['addincome']; $addpayment = $_POST['adddate']; $addsubbie = $_POST['addsubbie ']; $addclient = $POST['addclient']; //connect with Database $host_name = 'xxx.hosting-data.io'; $database = 'xxx'; $user_name = 'xxx'; $password = 'xxx'; $conn = mysqil_connect($host_name, $user_name, $password, $databse); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO add_job (id, adddate, addcontact, adda, addb, addincome, addpayment, addcompany, addsubbie, addclient) VALUES (NULL, '$adddate', '$addcontact', '$adda', '$addb', '$addincome', '$addpayment', '$addsubbie', '$addclient')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } mysqli_close($conn); } ?>
The code seems to execute ok, when i check in firefox, the Params section is as expected so the correct info is being sent with the correct names…
no response…However, timings shows…
Blocked:
1 ms
DNS resolution:
0 ms
Connecting:
0 ms
TLS setup:
0 ms
Sending:
0 ms
Waiting:
84 ms
Receiving:
0 msNot sure if this means anything. I have changed the database and am now using the same database that the CMS is installed on.
Should it make a difference wether i use
INSERT
as shown above:$sql = "INSERT INTO add_job (id, adddate, addcontacct, adda, addb, addincome, addpayment, addcompany, addsubbie, addclient) VALUES (NULL, '$adddate', '$addcontact', '$adda', '$addb', '$addincome', '$addpayment', '$addsubbie', '$addclient')";
or like
$sql = "INSERT INTO
add_job(
id,
adddate,
addcontact,
adda,
addb,
addincome,
addpayment,
adddsubbie,
addclient`)
VALUES (NULL, ‘$adddate’, ‘$addcontact’, ‘$adda’, ‘$addb’, ‘$addincome’, ‘$addpayment’, ‘$addsubbie’, ‘$addclient’)”;’- This reply was modified 5 years, 2 months ago by Supplement Genie.