Displaying javascript variables and database values? - php

Is there a way to display javascript variables and mysql values in a sort of label? As in say you have a letter template and there are spaces in the template where values from a database should be inserted but not in a text box. Here is a screenshot of what i am trying to explain :
The letter on the left is the template and the blue coloured text is where the database values need to be entered but in a format that would suit the letter template which will be printed and mailed out, so it couldn't be a text box, is there a way to display it in this manner?
Here is my current code :
Also is there a way to display that section of javascript in the same manner? Where it says [server date] in the template?

Related

PHP text box replace with variable

I'm creating a small customer database that allows me to send an email.
So what I would like to do is, click a link that opens a page with a big text box.
Within this text box I'd get a preformatted HTML mail, that I can adapt if I want.
When I process the form text box I would like to search for all the variables that have been written in the textbox. (because besides plain HTML I would like to be able to use variables where I want within the email)
I want to be able to write the variable in my text box between << some_variable >>
Then I would like the processing page to search for all text between << ** >>.
And replace it with $some_variable.
(off course we would know the syntax off the variables up front)
So for example in the html form input box I would like to type this:
Hi <<First_Name>>,
You registered for course <<course_number>> <<course_title>>.
Total to pay <<Total_to_pay>>.
Thanks
but I would also want to be able to change the format whenever I want.
So example:
Hi <<First_Name>>,
Your course <course_number>> <<course_title>>, will start tomorrow.
Dont' be late.
Thanks
You can post or get the input value to session and set the session result as a first_name

Adding elements to a table from an input area

I am trying to have something like the image below in my PHP page.
(The links are in the comments. I was unable to post them here properly)
Once I enter the keyword and hit the "plus" it should appear in the table, along with the color to the right. The sequence of colors will be predetermined. If I enter a keyword again and hit the "plus" again, the keyword should appear just below the earlier keyword int the table. For the time being I am assuming the table consists of 5 rows and there are less than or equal to 5 keywords.
Also I want to have a submit button at the bottom that when clicked should send all the keywords now present to a PHP file. I have a form with the action attribute set to a PHP file. The table and the keyword input field are to be a part of a form.
I prefer using javascript and not PHP for many complications. Is there a way I can store all the keywords and then send it to the PHP file once the form is submitted?
Any help would be greatly appreciated.
You could:
Build the html form with five text inputs, all stacked on top of one
another (I think using position: absolute).
Place html table underneath inputs.
Place submit button underneath table.
Use javascript to:
hide the four text inputs that aren't currently being used
display the text input and corresponding color in the table when the user presses the +.
hide the current text input and show the next input when the user presses the +.
When user hits submit button, all five input values will be submitted to action='*.php'

I want to move a value from one text field to another text field in one html page using codeigniter

I want to move a value from one text field to another text field in one html page using codeigniter. here we can write something or fetch something from db into the first text area. i dont understand how to do that ??
While your question is far from clear, this will probably help to get you started.
You can use CodeIgniter sessions, PHP sessions or just post the value using a form if you need it sent from one page to another.
However, if you need to copy values within a single page, something like this will do (and has nothing to do with CodeIgniter).

Data is not pulling from mysql db into php app - textarea field issue - maybe?

Think I need to come at this from another angle now - I have an issue that I originally blamed on tinyMCE [and part of it was related to tinyMCE], but now after much research, I 'think' this new issues has something to do with Textarea field limits, db field limits, something...
I have a php web form, in addition to the other fields, there are three text area fields, that allow the user to enter comments that will display at the top of the form, end of form and on thank page. TinyMCE is attached to these fields, so user can format their text. After resolving the funky chars that were appearing in my db because of Word copy/pasting, the issue I now face is that after the text has been submitted to the db, if it is very long amount of text, it will not pull/display on the php page.
For example, I enter a 100 word paragraph, save it to the db, open the web page, I see the text. Now if I add 1K words, 2K words of text, nothing appears on the web page, not even the div border that I have set to encase this text. It's like nothing is in the db field, but if I go to the db, to that field, I see all the text. Then if I remove 90%, 80%, etc of the text, update the db, open the web page, the text is then viewable.
I have changed field type from "text" to "mediumText", increased column in the textarea field to 40 from 16. Nothing is working. What else do I need to consider, do, try, etc?

Getting the value of dynamically created text box in PHP

I have a link. Whenever it is clicked, a new page will be displayed which contains data such as id, name, price and a select option with a check box. This page also contains a button. All these details (id, name, price) are fetched from a table. If the check box is checked and the button is clicked, a new page with the selected values along with a text box for each id should be displayed. If a value is entered in those text boxes and the button is clicked, I should fetch the value of the text box. I have given the text box the name id (which is retrieved from the table).
I assume the new text box is created using javascript. Give it a fixed name attribute that your PHP script knows and read it from _POST[]
Well, there are two ways of doing this.
Name your text boxes as an array. So the name would be name[] or name[2]. Then, in PHP just loop over $_POST['name'] which will be an array (or empty if no text boxes were added). That way, you only need to submit the data that exists...
The other way would be to use Javascript to do the submission. You'd need to assemble the response into a common format (JSON perhaps) and then send that to the server...
But it's definitely possible...
You can use a naming convention for the name property of the textboxes that append an integer value to the end of the whatever generic name you use. Store the number of textboxes created and once the page is posted, you can reconstruct the name of the textboxes with a loop and read the posted values.

Categories