I am newbie ,am trying to process perl script on submit button in HTML in Django framework.I will try to be clean and clear what i wann do, Apologies for my English language.
I have build simple registration website using Django framework.In that instead of using Django auth, i want to call perl script and process the new user registration form.
I have written code for simple new user registration form and perl script which takes data from HTML and splits that data and send it to back-end for further process.I successfully accomplished this task using CGI server.
This process i want to call in Django framework .How can I do this .I tried to do it with subprocess but Am not getting solution for this .
Thank You
Pervez
run your perl script as cgi, post registration form to the script
<form action="your-perl-script.cgi" method="POST">
...
</form>
I don't quite understand why you would want to do that, but you can run the perl script as a system command, like:
import commands
commands.getstatusoutput('perl /path/to/script.pl arguments')
Related
I am new to NodeJS, and I was wondering how I can get data after I submit a form on a webpage and store it into my mysql database on the same website. I know how to make the form, I know how to use NodeJS to insert a row in the mysql database. What I don't know is how to connect the two. Most tutorials on NodeJS involve a local server (not a real website), and all of the tutorials use the terminal and command line to get the app running. Is there some way I can use the 'action=""' feature of the HTML form to POST data to my database using NodeJS? How? I am very lost.
I am new to Node.js ,with the help of this
tutorial I've learned how to write REST API using Node.js .Can anybody please help me to understand how to upload an image file using Node.js and saving it in mysql table ? I've been searching for it , but couldn't get something useful . Any help would be useful to me.
Typically files are uploaded as multipart form data from a web page. You could start there with a simple <input type="file"> on a web page.
Create an endpoint in Express, and consider a package to help parse it. One like express-formidable would be a good start. Then you will have the file from the request.
To save to mysql, I'd suggest the package knexjs. This is a nice library to programmatically write SQL queries. You'll have to define your own tables that store the image (probably as BLOBs) and you can use Knex to store the new images into your DB.
Be aware of the asynchronous flow in NodeJS. For your Express endpoints, you only want to finish the response after the DB code is done, like inside the knex call's callback (or at the final .then() of a promise chain)
I am trying to write a sample web project that connects MySQL and executing querys such as creating a new user and deleting an existing user.
I wrote all the querys (prepared statements) in java classes.
Now I am trying to write the html file so clicking a button will call the statements that are written in the java classes.
How can I do that, without using JSF?
I want to use Angular but I don't understand how to make that connection between the html file and the java classes. Is is possible with angular?
If not, should I just use the regular JSF to do so?
Thanks
I have a html form ... While submitting that form, I am calling one Perl CGI Script, that will save the data in MYSQL database.
After saving the data in databse, i want to reopen the same page with all empty fields in form, means i want too reload the same form again.
How can i achieve this? or what should i call in my script so that i can come back to same form again.
Remember i am generating the forms using template and perl script..
Thanks in advance
You can redirect using HTML's meta refresh or by using JavaScript's window.location object. Have the CGI script output any of those.
Another way is to have the CGI script output a redirect header. You can use CGI's redirect method for this, or output it manually.
Is this second program really a CGI program? I mean does it accept parameters from a HTTP request and return it's results in an HTTP response?
If that's the case then you can call it using libraries from the LWP CPAN distribution.
If your second program is actually just a command program then you can call it using system.
I am trying to access data from table with GetString() method and that data is stored in some variable then it must be loaded to html form when i am click the submit button. How to it? Please help me......
This question is too general.
In order to access the database you need a web server running server-side code in a language such as ASP.NET, Java, PHP, etc. The server code would be responsible for using a "GetString()" method to read the table and populate data in the form (or even better, return it to an MVC View or to JavaScript via AJAX to load it onto the HTML form).