473,503 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to make a user suggestion form

145 New Member
I have a form where user will insert any suggestion that they may have.

I want to know how to make each suggestion appear according to the newest to oldest where the newest is on top and oldest below on the same page. As user click submit button it will appear on the page. It is the same way this site operate when there user post question and other reply, then the it wil display on the same page according to date.

How can i do this? Does it involve javascript?

Im thinking of using iframe in my html/css. Can it work?
May 21 '10 #1
8 2229
ThatThatGuy
449 Recognized Expert Contributor
Are you trying to say. that you want to build something like google suggest
May 21 '10 #2
puT3
145 New Member
sorry i dont know google suggest..but what im want to do is like this site where when user post a reply, the reply will show on the page..
May 24 '10 #3
puT3
145 New Member
@puT3
My code is like below:

Expand|Select|Wrap|Line Numbers
  1. <%
  2.   Response.Write(Request.Form("txtNama"))
  3.   Response.Write(Request.Form("txtEmail"))
  4.   Response.Write(Request.Form("txtCadangan"))
  5. %>
  6.  
  7. <div id="colTwo">
  8.        <h2>Cadangan Anda</h2>
  9.        <p>Sila isikan cadangan anda.</p>
  10.  
  11.         <form name='cadangan' action='c2.asp' method="post">
  12.         <table>    
  13.  
  14.             <tr><td><p>Nama:</p></td>
  15.                 <td><input type='text' name='txtNama' size='40'/></p></td>
  16.             </tr>  
  17.  
  18.             <tr><td><p>Email:</p></td>
  19.                 <td><input type='text' name='txtEmail' size='40'/></p></td>
  20.             </tr>   
  21.  
  22.             <tr><td><p>Cadangan:</p></td>
  23.                 <td><textarea rows="10" cols="31"             name="txtCadangan"></textarea></p></td>
  24.             </tr>
  25.  
  26.             <tr><td><p></p></td>
  27.                 <td><p></p></td>
  28.             </tr>
  29.  
  30.             <tr><td><p></p></td>
  31.                 <td><p></p></td>
  32.             </tr>
  33.             <tr><td>&nbsp;</td>
  34.                 <td align="center"><input type="submit" value="Hantar" />
  35.                     <input type="reset" value="Batal" /></td>
  36.             </tr>
  37.  
  38.         </table>
  39.         </form>
  40. </div>
  41.  
  42.  
From this code, how can i make sure the earlier suggestion still on the page and it is not being replaced if there is a new suggestion is submit.
May 24 '10 #4
ThatThatGuy
449 Recognized Expert Contributor
@puT3
Ok, i got it.
You need to store the suggestion entered by the user in the database.
While, the table in which you'll be storing the data will also contain an autonumber or identity column.

So whenever you addany data to the database it will automatically generate the autonumber for the record.

And by the getting the list of data by order by descending inside the select query you can get the most updated data... in descending order
May 24 '10 #5
puT3
145 New Member
@ThatThatGuy
ok thanks...

I alread tried but when i click submit the data entered does not appear in the table.

My database:

Table name: Cadangan
Expand|Select|Wrap|Line Numbers
  1. ID (Autonumber) PK
  2. Nama
  3. Email
  4. Cadangan
  5.  
While the code in my asp file as below:

Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3.         var DSN ="C:/Inetpub/wwwroot/TM/Telekom.mdb"
  4.         var Conn = Server.CreateObject("ADODB.Connection");
  5.         Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
  6.         Conn.Open(DSN);
  7.  
  8.         if(Request("Hantar") == "SUBMIT")
  9.         {
  10.  
  11.             var frmNama=Request.Form("txtNama")
  12.             var frmEmail=Request.Form("txtEmail")
  13.             var frmCadangan=Request.Form("txtCadangan")
  14.  
  15.             sql2="INSERT INTO Cadangan(Nama,Email,Cadangan) VALUES ('"+ frmNama+"','"+frmEmail+"','"+frmCadangan+"')";
  16.  
  17.             Conn.Execute(sql2);
  18.             Conn.Close()
  19.             Conn = null
  20.         }
  21.  
  22.             sql ="SELECT * FROM Cadangan"
  23.  
  24.             rs = Server.CreateObject("ADODB.Recordset");
  25.             rs.Open(sql,Conn);
  26.  
  27.             out = "<table>"
  28.             while (!(rs.EOF))
  29.             {
  30.                 out += "<tr><td>" + rs("Nama") + "</td><td>" + rs("Email") + "</td></tr>"
  31.                 out += "<tr><td>" + rs("Cadangan") + "</td><td></td></tr>"
  32.  
  33.                 rs.Movenext();
  34.             }        
  35.             out += "</table>"
  36.  
  37.             rs.Close()
  38.             rs = null
  39.             Conn.Close()
  40.             Conn = null
  41.  
  42.             Response.Write(out);
  43.  
  44.  
  45. %>
  46.  
My form:
Expand|Select|Wrap|Line Numbers
  1. Nama:<input type="text' name="txtNama">
  2. E-mail:<input type="text" name="txtEmail>
  3. Alamat:<textarea></textarea>
  4.  
Is there any error it in? because I cannot see it. Please look and correct it if any.
May 24 '10 #6
ThatThatGuy
449 Recognized Expert Contributor
@puT3
It won't happen automatically ...
I suggest you should have a gridview or a FormView kind of a control
which will show the posts as per to the most recent one..
update the gridView from database on every postback or when the data is submitted to the database..

or you can do it manually if you want to do this via HTML
May 24 '10 #7
puT3
145 New Member
hi,
what do you mean by gridview or formview?i dont understand...and if by html how to do it?

does it mean my code above cannot be used?
May 24 '10 #8
puT3
145 New Member
Thats ok..Forget about...Thamks
May 25 '10 #9

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

Similar topics

4
6351
by: harrylmh | last post by:
Hi, I've really been struggling with this. How do I make a form resizable with FormBorderStyle = None? I've had problems trying to get the form to start resizing by following the mouse...
10
1322
by: Ioannis Vranos | last post by:
Is there any way to make a form *not closing* when its X on the upper-right is clicked? Is there any event for handling clicks on the X (e.g. to perform additional actions)?
4
2285
by: Sumit | last post by:
Can any one Please tell me how to write a code to make a form that has only one instance. Like in Visual Basic 6.0
0
1420
by: Ricky Kam | last post by:
Hello, In my program, I'm opening a windows form(name it "s") from the main form(name it main). When form "s" load, it is movable even when it's maximized, which I don't want. Also, when the form...
0
819
by: Jerry Spence1 | last post by:
In VB6, I was able to step through the code and whenever I came to a part that added a control, or added text to a textbox etc, I was able to task switch and see the form so's I could see that...
2
4146
by: Srin | last post by:
Hi, I've been trying to write a small windows application in C#. I want the form to read special input sequences act accordingly. For example, <Alt><Ctrl>H should bring up the help box etc. I...
1
1413
by: monicarana | last post by:
Hi All, I have a form with a field "ID" and a View Button. I am calling another form on the press of a view button, the called form should display the data corresponding to the ID field in the...
1
1176
by: rayazax | last post by:
Hello, I need to make my form to act like a task bar. I mean, I want my form to be top over all other forms, and to be task bar. I mean all other forms must be above it. I am trying to use...
3
1203
by: seangibson | last post by:
I have a form for entering data into a table. I would like the form to be blank when I open it, but it is showing the data contained in the first record of the table. Is there any way to set the...
6
2353
by: 85ssp | last post by:
I have a server applicatoin that has a multitude of labels related to the clients connected to it. When I have a number near 50 clients and i recieve a updatated status from each of the clients at...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.