473,411 Members | 1,889 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,411 software developers and data experts.

i want submit a form continuosly selecting some values from the database

i want this form to loop through counting the number of people in d table and geting the next name after submiting the first. i really need help

[<?php $getcat = mysql_query("SELECT * FROM stud_registration where entry_class ='$g'");
$rss=mysql_fetch_array($getcat);

?>

<table width="549">
<tr>
<td height="123" valign="top"><form id="form1" method="post" action="control.php?my=addscore">
<table width="541" cellpadding="0" cellspacing="1">
<tr>
<td height="12" colspan="4"><strong>Name:</strong>&nbsp;&nbsp;<? echo $rss['title']; ?> &nbsp;&nbsp;<? echo $rss['surname']; ?>&nbsp;&nbsp;<? echo $rss['middlename']; ?>&nbsp;&nbsp;<? echo $rss['firstname']; ?></td>
<td colspan="3"><strong>Term:</strong>&nbsp;&nbsp;<? echo $rss['entry_term']; ?><? echo $cou;?></td>
</tr>
<tr>
<td height="13" colspan="4"><strong>Userid:</strong>&nbsp;&nbsp;<? echo $rss['userid']; ?></td>
<td colspan="3"><strong>Session:</strong> &nbsp;&nbsp;<? echo $rss['entry_session']; ?></td>]
Sep 7 '10 #1
1 1004
TheServant
1,168 Expert 1GB
Welcome to Bytes. Please use [code ][/code] tags around your code.
If I understand correctly you can do this several different ways. I would guess that seeing as you're only doing one record at a time, you want to use mysql_fetch_row() instead of mysql_fetch_array(). Also, you want to look into using LIMIT in your query statements to save your server processor time. So you would do something like:
Expand|Select|Wrap|Line Numbers
  1. $getcat = mysql_query("SELECT * FROM stud_registration WHERE entry_class ='$g' LIMIT 1");
  2. $rss=mysql_fetch_row($getcat);
Now to after a user submits a form you need something to tell you where you are up to in the list. So I would say make a hidden <input /> to include which number you're upto (which can be accessed by $_POST['number'] or something). This would change your code to something like:
Expand|Select|Wrap|Line Numbers
  1. if ($_POST['number']>0) {
  2. $number = $_POST['number'];
  3. $getcat = mysql_query("SELECT * FROM stud_registration WHERE entry_class ='$g' LIMIT $number,1");
  4. // This skips $number records and returns 1 record
  5. } else {
  6. $getcat = mysql_query("SELECT * FROM stud_registration WHERE entry_class ='$g' LIMIT 1");
  7. }
  8. $rss=mysql_fetch_row($getcat);
The other option is to save the array you get from mysql_fetch_array($getcat) into the $_SESSION variable and then call out the "sub-arrays" depending on what number form you're on. This saves your server from handling so many calls, but will not be quite as flexible as fresh calls (if data is updated after you have made the first and only mysql_fetch).
Sep 8 '10 #2

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

Similar topics

5
by: Bandit | last post by:
Hi there, I am looking for any help with a form I am trying to make, one of the feilds I want it to be a drop down menu, so this part of the form has set values and nothing else. I have tried a...
8
by: dmcconkey | last post by:
Hi folks, I have a client with four websites. Each site has a contact form that is identical. They all have "required" fields validated through a JavaScript onSubmit() function. Upon validation,...
3
by: Mark Michel | last post by:
Hi. I have made an html form which I would like to send by e-mail. When the recipient receives the e-mail form, I would like them to be able to fill it out and click the Submit button which will...
2
by: Terence Parker | last post by:
How does one go about submitting a form with a link - but submitting it to a new window AND to a page different to that described within the action="" option of the <form> tag? Say, for example,...
1
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
4
by: karenmiddleol | last post by:
I have a simple form to accept two form fields and display the values entered on pressing the submit button. The following is the form I have created to accept the two entries and display the form...
1
by: Andy Kasotia | last post by:
I have an ASP UI with VB Dll as a COM object that access the DB2 Database. I have a "Calculate" button on the ASP Page which when clicked does form validation (javascript) and submits the form...
1
by: tuckertickler | last post by:
I am brand new to this and trying to get a "submit form" to enter it's information into a database I have with www.servage.com. They have MySQL and I have created a database with their system. I...
1
by: archcool | last post by:
I want to display new empty text fields within the same form after selecting an option from a combobox. here is the form Filter by:todays date,from date ---- in a combobox when from date is...
12
by: backups2007 | last post by:
How do I submit form entries to the database and redirect to the same page, with the entries still display on the fields of the form? I really need help on this. Thanks.
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
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
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...
0
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,...
0
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
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...

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.