1548768640
Well I followed this question, but cannot send array to php it returns me always empty:
JS:
values = []; values['mpsRegnomer'] = $('#mpsRegnomer').val(); values['mpsMarka'] = $('#mpsMarka').val(); values['mpsMarkaOther'] = $('#mpsMarkaOther').val(); values['engineType'] = $('#engineType').val(); values['seatNumberInput'] = $('#seatNumberInput').val(); values['carColor'] = $('#carColor').val(); values['mpsChassiNum'] = $('#mpsChassiNum').val(); values['mpsModel'] = $('#mpsModel').val(); values['mpsModelOther'] = $('#mpsModelOther').val(); values['mpsManufactureDate'] = $('#mpsManufactureDate').val(); values['mpsfor'] = $('#mpsfor').val(); values['VehicleType'] = $('#VehicleType').val(); values['dvigatelInput'] = $('#dvigatelInput').val(); values['engineMaxPower'] = $('#engineMaxPower').val(); values['is_automatic'] = $('#is_automatic').val(); console.log(values);$.ajax({ type: 'POST', url: 'assets/clients/services/saveDataMPS.php', async: false, dataType: "JSON", data: {"values": JSON.stringify(values)}, success:function(response){ alert(1); } });
console.log(values) show me that array is OK.
PHP code:
<?phpvar_dump(json_decode($_POST[“values”])); exit;
It returns me always empty, also tried only with var_dump($_POST); same result… Where am I wrong?
Result from console.log(values):
#javascript #php #ajax #jquery
1548772039
You defined values as an array and therefore when you stringify it, you get an empty array. Define it as an object like values = {}; and it will work.
You don’t use associative arrays in javascript because
If you use named indexes, JavaScript will redefine the array to a standard object. After that, some array methods and properties will produce incorrect results.
Thats’s why you need to define it as object in the beginning.
values = {};
values['mpsRegnomer'] = $('#mpsRegnomer').val();
values['mpsMarka'] = $('#mpsMarka').val();
values['mpsMarkaOther'] = $('#mpsMarkaOther').val();
Here is a working JSFiddle. http://jsfiddle.net/pk97fe0b/
1615040237
PHP jquery ajax POST request with MySQL. In this tutorial, you will learn how to create and submit a simple form in PHP using jQuery ajax post request. And how to submit a form data into MySQL database without the whole page refresh or reload. And also you will learn how to show an error message to the user if the user does not fill any form field.
And this tutorial also guide on how to send data to MySQL database using AJAX + jQuery + PHP without reloading the whole page and show a client-side validation error message if it has an error in the form.
Just follow the few below steps and easily create and submit ajax form in PHP and MySQL with client-side validation.
https://www.tutsmake.com/php-jquery-ajax-post-tutorial-example/
#jquery ajax serialize form data example #submit form using ajax in php example #save form data using ajax in php #how to insert form data using ajax in php #php jquery ajax form submit example #jquery ajax and jquery post form submit example with php
1597487472
Here, i will show you how to populate country state city in dropdown list in php mysql using ajax.
You can use the below given steps to retrieve and display country, state and city in dropdown list in PHP MySQL database using jQuery ajax onchange:
https://www.tutsmake.com/country-state-city-database-in-mysql-php-ajax/
#country state city drop down list in php mysql #country state city database in mysql php #country state city drop down list using ajax in php #country state city drop down list using ajax in php demo #country state city drop down list using ajax php example #country state city drop down list in php mysql ajax
1597820991
Looking to develop a PHP based website from scratch or revamp your existing website?
HourlyDeveloper.io has always been an industry leader for companies and business owners looking to hire PHP web developer. By choosing to Hire PHP Developer from our company, you can always expect the best results. Our PHP services and solutions are always flexible which means that no matter the nature of your project, you can always count on us for getting the best PHP expertise.
Consult with our experts: https://bit.ly/3aEGxPy
#hire php developer #php developer #php development company #php development services #php development #php
1626852600
Hi guys, welcome to my PHP course for beginners in 2020.
Do you want to learn PHP from scratch? In this course, I will be going through all the basics of PHP. I will show you how you could use PHP in HTML code, what variables and data types are, all the different type of operators, control structures, user functions and built in functions and what the super globals are and how you could use them.
After learning all the basics topics, I want to focus on databases using MySQL because we will be creating a login system after.
In this episode, I want to focus on how to use arrays in PHP. An array is a type of data that allows us to store multiple elements of similar data type under a single variable.
#php #php programming #beginners #arrays in php
1548768640
Well I followed this question, but cannot send array to php it returns me always empty:
JS:
values = []; values['mpsRegnomer'] = $('#mpsRegnomer').val(); values['mpsMarka'] = $('#mpsMarka').val(); values['mpsMarkaOther'] = $('#mpsMarkaOther').val(); values['engineType'] = $('#engineType').val(); values['seatNumberInput'] = $('#seatNumberInput').val(); values['carColor'] = $('#carColor').val(); values['mpsChassiNum'] = $('#mpsChassiNum').val(); values['mpsModel'] = $('#mpsModel').val(); values['mpsModelOther'] = $('#mpsModelOther').val(); values['mpsManufactureDate'] = $('#mpsManufactureDate').val(); values['mpsfor'] = $('#mpsfor').val(); values['VehicleType'] = $('#VehicleType').val(); values['dvigatelInput'] = $('#dvigatelInput').val(); values['engineMaxPower'] = $('#engineMaxPower').val(); values['is_automatic'] = $('#is_automatic').val(); console.log(values);$.ajax({ type: 'POST', url: 'assets/clients/services/saveDataMPS.php', async: false, dataType: "JSON", data: {"values": JSON.stringify(values)}, success:function(response){ alert(1); } });
console.log(values) show me that array is OK.
PHP code:
<?phpvar_dump(json_decode($_POST[“values”])); exit;
It returns me always empty, also tried only with var_dump($_POST); same result… Where am I wrong?
Result from console.log(values):
#javascript #php #ajax #jquery