Code needed for form to talk to phpmyadmin backend - javascript

I am creating a search form in wordpress using html and javascript. The form has dropdown menus which will have preselected items. These items come from the phpmyadmin(wordpress backend database). I'm having trouble writing the php code so the form talks to phpmyadmin backend. Does anyone have code for this?

John is right on that. PHP MyAdmin is a web based utility for accessing MySQL similar to WordPress which is a CMS. You will need to make queries to the backend database either directly(Not Advised) or to a web server. Wordpress has support for plugin databases built right in. Just gotta do a couple things.
Per The WordPress Site
Write a PHP function that creates the table.
Ensure that WordPress calls the function when the plugin is activated.
Create an upgrade function, if a new version of your plugin needs to have a different table structure.
WordPress - Creating Tables with Plugins
If you insist on writing it yourself you will need to setup a web server like Apache or nginx to listen to request and execute your PHP scripts.
PHP 5 Form Handling
PHP Connect to MySQL
and if you want to go dynamic
Ajax and JS, but you may want to use PostMan for testing.

Related

How to call a plugin outside of Wordpress?

So, I need to call a plugin from outside my woocommerce websites. I have my own database that connects to Woocommerce throught REST API when it comes to products, orders and etc. My problem is, now I need to call a plugin on admin.php?page=pluginName&action=action&orderid=123456.The server that communicates with woocommerce is using classic ASP. I already tried to simply do a POST but of course wordpress asks me for login. I even tried to post it to a custom php page inside woocommerce and then post it to the plugin page but no success. Is there any way to call the plugin URL without having to login every time? It can be a php code inside my woocommerce FTP that recieves a POST with the order ID (the only query string that changes on each recordet) and then makes an AJAX POST to the plugin or something
Tried to create a custom PHP code to retrieve the POST and then do a wp_remote_post to the admin.php URL but nothing works. I just need to run the url, the plugin does the rest then
WordPress plugins rely on a lot of WordPress core code to function. Getting them to stand alone will be a LOT of work and your result will be brittle if you can get it to work at all. (Brittle === anything might break it, including a core or plugin update.)
WordPress's REST API is the best way to access WordPress, including plugin functionality, from some other network server. WooCommerce also supports REST, documented here. It offers an API key subsystem allowing secure authentication.
It's a programming task, but not unreasonably hard, to write a small plugin that adds a REST endpoint or two for a special purpose. But it's possible the one of the existing WooCommerce REST endpoints will serve your purpose. (You didn't tell us what it is, so it's hard to give more detailed advice.)

Using javascript to pass web forms values to python script

What I have done:
1- Created a web form using HTML and javascript to create a SSL certificate that can create dynamic certificates.
2- Successfully parsed through an existing certificate and passed the required values to the web form.
3- I am using the HTML+javascript inside the python script itself and appending the parsed certificate values to the javascript before displaying it.
What I need to do:
1-Take values from the web form, assign those to particular variables and pass those variables to a python script, that can create a CSR using those and sign it using a dummy key.
So, basically, I want to call a python script on a click of a button that can take web form values and create a certificate.
P.S. PHP isn't an option for me, as the server I am working on doesn't support it.
Can someone guide me in the right direction as for how to proceed? Any examples or study material? Or should I start working with Flask?
Django is a good option to create applications using python. You can start an application, and embed your code in template and write a view to handle requests and responses.

helping inserting entries to Azure DB

Im just starting out using Azure and i have minimal experience with SQL, so I'm a little confused. I set up my Azure Webapp to pull from a Git repository on bitbucket. I successfully linked those two together, and pushes made to bitbucket update my site. What I am having trouble doing is linking my database on Azure to this site, so that I can make data entry forms and insert that info as records onto this database. Im just starting out simple to learn the basics. I have a table names Users with the elements, id(which is set up as IDENTITY so it sequentially creates a unique id number), username, password, and email. I can pull the info from the HTML document and everything just fine, but how do I correctly link my DB and its tables using HTML, js, and azure? Ill post any additional info that will be necessary, i dont even know where to begin on this really.
Ill also add im using Visual Studio for creating tables and entities and most DB management.
Thanks in advance.
How to access your database depends on the database you are using and the server side programming language. From the tags you used in your question I assume you are using the mysql database provided by clear db through the Azure Management Portal. You can not access your database right from JS. As you are using VS I guess you are using asp.net on the server side. If using asp.net this article might help: https://msdn.microsoft.com/en-us/library/ms178371%28v=vs.100%29.aspx
If you created a ms sql database through the SQL Database service in MS Azure you also need to check the firewall settings to allow access from your app.

Can I use PHP SDK and JAVASCRIPT SDK at the same time?

I have a php program/app which asks for input, generate an image and post th image link to user's timeline (processor.php). I used PHP SDK in posting to timeline since I am more familiar with PHP. Now, in my gallery.php, i want to show like buttons for each generated image. I am aware that i have no option but use JS SDK in making button. but is it fine if i use two different SDK's in a single app?
processor.php - PHP SDK
gallerry.php - JS SDK
thanks for your answer! I would love to try your suggetions too
There shouldn't be any problem using PHP and JS in the same application, quite a common use case. You would normally use PHP to create the Web Application structure, handle backend logic, and then use JS to handle UI events.
There's nothing special about combining the two, just create the Web page with JS as normal for the view, and use PHP to build it.
Hope this helps.
Yes, there is no problem, the two APIs are designed to work together. The PHP API is usually used to created the backend logic (for example OAuth implementation, posting and getting data, etc) and the JS API to handle user iniated events.
Also see this: https://stackoverflow.com/a/6728092/1107118 on how to handle login state. Normally the JS API is used for logging in too, and then with the PHP API you take the access token and do the backend actions.

How to handle Async Notification in Pyjamas?

I am writing a web application using Pyjamas. .
The core functionality of my application is to show some Events which are generated asynchronously, in an HTML table (using the corresponding pyjamas widget).
Is it possible to send these notifications to the pyjamas application running in the browser?
I have been looking for an example without success.
I don't know if you are familiar with the pyjamas bookreader?
If not, there's a lot of information and some examples about ajax over there.
http://pyjs.org/book/Bookreader.html#Rest%20of%20the%20World

Categories

Resources