Jump to content

PHP, Javascript & Wordpress. Simple form question.


mtidavid

Recommended Posts

Alright, I am struggling to get back into the world of programming. I have background in C++ and Javascript, but this was 7 years ago. I am now trying to develop a plugin for a wordpress website I manage and am having a simple problem. It seems like it is at least.

 

Here is what I need to accomplish. I am designing a plugin that generates a random string of text on a wordpress page. It uses a shortcode to return a form onto the page where it is placed. The form has 3 elements, a textbox, a dropdown list, and a submit button. I can do all of this so far.

 

Here is where I am a bit lost. When the submit button is pressed, I need it to run a function passing the value selected in the dropdown list. I would like this to be contained on the same page. So I am not sure what I need to put in the action="", and my guess is I would use the post method.

 

The function that generates the text returns a paragraph. So it would function like this...

 

$paraText = genParagraph($txtType); //txtType would be the drop down value

 

Currently, I do this and return the value (after slightly more processing). My guess is I have to use the $_POST[] function to somehow return the data into the text box on the page. I am not exactly sure how to achieve this.

 

Thank you for your help!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.