How to change an html paragraph text based on selected radio button? - php

I have been developing a course management system with PHP and MySQL. I recently ran into a problem. I created a basic webpage (EditCompletion.php). Basically, what I want to do, is have a link on that page that opens a jQuery Modal Window and within that modal window should be 3 radio buttons, a small description paragraph (which changes when a new radio button is clicked), and a submit button. This is how I want it to work:
I want to be able to select a student (CERTAIN SELECTED STUDENT) and a lesson (CERTAIN SELECTED LESSON) then I want to be able to click the link on EditCompletion.php that then opens the jQuery Modal Window. I want to then be able to choose from the following options:
Unlock - (Description Paragraph - Are you sure your want to unlock (CERTAIN SELECTED LESSON) for (CERTAIN SELECTED STUDENT))?
Exempt - (Description Paragraph - Are you sure you want to exempt (CERTAIN SELECTED STUDENT) from (CERTAIN SELECTED LESSON))?
Master - (Description Paragraph - Are you sure you want to master (CERTAIN SELECTED STUDENT) out of (CERTAIN SELECTED LESSON))?
THE CERTAIN SELECTED will show up as the CURRENT SELECTED [WHATEVER]. For example, SELECT STUDENT JOHN DOE and LESSON 1 on EditCompletion.php and then click the link to open the modal. I want to select an option using radio buttons, and upon clicking "save", the MySQL database would be updated.

something like this?
<?php
for($samples as $sample){
echo '<a onclick="return (confirm(\'..message here.. for '.$sample['name']. 'about'.$sample['lesson'].'\'))? true: false;">Action</a>';
}
?>

Related

wordpress gravity form auto fill/select with current page title

I was wondering if it was possible to make a select dropdown inside a gravity form that can auto select a dropdown item according to the current page that it was loaded in.
For example:
I have 2 pages:
page A
page B
On every page I have the same form (form is made once).
And in that form I have a dropdown with 2 items (page A and page B)
But when I load page A I would like to make sure that the dropdown auto selects page A so that i can use conditional logic.
Ditto for page B.
How can i make sure that this will be possible in a short amount of time?
This is what i did so far:
app.js
e('.button[href^="#"]').on("click", e.proxy(this.openModal, this)),
this.prefillPopup();
prefillPopup: function () {
var i = parseInt(e("body").attr("class").split(" ")[2].replace("page-id-", ""));
e("#input_5_8").val(
{
427: "Personeelsfeest",
429: "Bedrijfsfeest",
431: "Walking en seated diners",
433: "Seminaries & Presentaties",
435: "Productlancering",
437: "Modeshows",
439: "Event op maat",
440: "Activiteiten",
}[i]
);
},
What i did is creating function that when the popup modal is opened/loaded the dropdown will be automatically filled with the data that I want it to be filled with.
The only thing is that it doesn't fill up with the content that I specify.
The dropdown needs to be filled with the desired titled related to the page ID that is being viewed in the browser at that time.

Dynamic Column Selection Menu and formula generator

How to create a dynamic menu in php html page wherein user can do all of following from front end:
I want that to create a two column window that displays different db col names from different tables. First window shows options for selection while, second window shows options selected and arthimetic operations on them from front end. We can save and create the output of these operations over selected columns into a new table or column of output. We can reuse this formula every time..since we have saved it by simply pulling the result col and echo it on a page.
Example: user selects a database column (e.g. "net profit") from first window and by clicking simply moves into 2nd window. Next he click "subtract button" and a minus sign appear in front of "netprofit" in 2nd window and then selects "tax" from first window and moves it to 2nd window. Next he clicks "divide button with / sign on it" and then clicks "total assets" from first window . Next he clicks save and winow prompts to assign a name to out put of the above..user names it as average profit over assets and saves it into new table. The output in table therefore will be processed based on this custom formula creation window and we can create complex formulas and save thier output and extract as required. The formula we created in above example is as under:
(Net profit before tax- tax)/total assets = Average net profit over assets.
Please guide on highlevel, how i can accomplish this . Also.tell me if there is an Api that can help achieve this quickly or I need to do all coding from scratch.
I believe one solution is to implement the window using checkbox list for colums pulled from db and embed them in scroll down div.
Next for all selections made take them and echo in a formula feild. For each add or subtract or multiply or divide button ..take respective values i.e + , - , × , ÷ and echo them in respective field. Once the formula is constructed .. post it and store in a new variable $ result. Next use it in a function or simply save/ insert it into a new table called formulas. Next extract values from the table and display/ echo on screen.
Any suggestions??? Am i thinking correctly?

Saving individual clicked combox items

I am trying to figure out the thought process behind the following. From a list of records displayed on the screen (php/mysql, each item will have a combo box or command button to "save to favorites". I would prefer the combobox, but beggers can't be choosers. This saved to favorites is a tab that list those items from the combo box or command button.
Make a table and copy the item number into that table and under the "saved to favorites" display those records? I guess another combobox on each listing to clear it from my favorites???
Did I just answer my own question? Could it be that easy???
Possibly,
If I understand you right, you could populate an item and it's item value.
Then submit this item number and user_value from a session maybe into a row in a new table, possibly favourites?
Would that work for you?
Unique key in your DB
unique index(user, item);

PHP, MySql Filling select box after press add button and send data to database

i have two select box i can add my choice from first box to 2nd box 2nd remove 2nd box to 1st box.
i can add all option from 1st box but not remove all from 2nd(at least one option there).
now how can i send this data in database. please give me solution.

Auto-Suggest JavaScript with Radio Button

I have one JavaScript through which I am getting a list of companies from memcache with auto-suggest. If I type 're' in the text box, then it will return all the company names that start with 're'.
I have another JavaScript through which I am getting a list of mutual-fund companies from memcache with auto-suggest as well. If I type 're' in the text box, then it will return all the mutual-fund company names that start with 're'.
I would like both to work on the same text box with a radio button that lets the user choose between 'ALL', 'MUTUAL FUND', and 'COMPANY', so if 'ALL' is selected, auto-suggest should suggest from both company names and mutual-fund company names based on the text inputted.
I've written my page in PHP.
Take a look at this tutorial:
http://www.dynamicajax.com/fr/AJAX_Suggest_Tutorial-.html
And then pass the id for the radio buttons

Categories