473,382 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Making new table on a same page, using values entered by user.

Hi there.
I'm a newb in php so, you'll have to forgive me for such a simple question i guess.
I need to form out a table from the values, users enter in textareas.
For example
Expand|Select|Wrap|Line Numbers
  1. <td><input type="textarea" name="room" id="room" style="width: 25px"></td>
  2. <td><select id="city" name="city" style="width: 50px; border: 1px solid black;">
  3.         <option value="" selected>
  4.         <?
  5.             $q = mysql_query('SELECT * FROM city ORDER BY name');
  6.             for ($i=0; $i<mysql_num_rows($q); $i++)
  7.                 print '<option value="'.mysql_result($q,$i,'name').'">'.mysql_result($q,$i,'name');
  8.         ?>
  9.         </select>&nbsp;&nbsp;
  10.  
I need to get all data entered by user into a table using for example:
Expand|Select|Wrap|Line Numbers
  1. $sql_query = "INSERT INTO dogovora (roomb, city...) VALUES ( ";
  2.  
So the question is... how to create a table below with this values on a same page.
Thanks!
May 19 '11 #1
1 1065
ronverdonk
4,258 Expert 4TB
Enclose the input fields in a form, add a submit button which submits the form to your MySql insertion part en process, like:
Expand|Select|Wrap|Line Numbers
  1. //  check submission
  2. if (isset($_GET['submitted'])) {
  3.     .... check $_GET['city'] and $_GET['room'] for validity
  4.     .... insert values into database
  5. }
  6. else {
  7.     // Prompt for values
  8. ?>
  9.    <form>
  10.    .... your input fields ....
  11.    <input type='submit' name='submitted' value='Submit data' />
  12.    </form>
  13. <?php
  14. }
  15.  
Jun 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: ...
1
by: Jimmy | last post by:
I have a table that is shown below in ORIGINAL TABLE. It is common for the VEHICLE # field to have repeating vehicles (ID 3,4,5 & 8,9). Usually the Vehicle will have SHIPDATE, DATE_RECEIVED, and...
2
by: vineetbatta | last post by:
Hi all, i have a user control which allows the user to enter Name& Address in text boxes. I use the same user control in the main page... Is there a simple way of accessing the Name &...
3
by: gw.boswell | last post by:
I have created a userform with textboxes for data entry. I also have a command button that calls a second useform. A user enters certain information in the first useform but if he/she wants to do...
1
by: Rajasuds | last post by:
I have a question in MS Access I have two tables MASTER with Fields 1, Field 2, Field 3 TRANS with Field1, Field 2, Field,10 I need to set up a look up condition where, I need !Field 2 to...
2
by: sujith.bolar | last post by:
Hello I am using a <form method="post"to submit values to the processing agent. If the processing agent returns an error, I call the history.go(-1) or history.back() function to reload the page....
1
by: b00gieman | last post by:
Hi! I want to do a page similar to the yahoo email.After uploading files,the user can go back to the initial page.On the initial page,I have html forms.How can I retain the values entered in the...
1
by: zoeb | last post by:
Currently I have a table, and would like the calculate a field in the table by referencing values from another 3 tables. i.e. tblData Index1, Index2, Index3, Value 1 2 3 2...
13
by: ramprakashjava | last post by:
hi, i hav "java.lang.NullPointerException" error while Deleting table records using checkbox in jsp here i enclosed files help quickly plzzz.. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.