/    Sign up×
Community /Pin to ProfileBookmark

load checkboxes,testboxes on the fly

I have been given the task of taking my companies software product and converting it to a web app. I will be pulling information from a table in oracle and creating multiple checkboxes,textboxes,etc. on the fly according to the data. Is this easily done in php? I’m just researching this now to see what the best way to write this web app would be. Thanks for an advise!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Michel_v_DuijseFeb 27.2004 — I'll skip the database part here, if you need that as well, let meknow.

What you can do, is loop through a sql resultset and create a textbox/checkbox andso for every row you have.

You'll have to write the html code for the textbox inside the loop.

Here an example, to create a textbox:
[code=php]
//get the fieldcount
$num_fields = mysql_num_fields($result);
while ($row = mysql_fetch_array($result)) {
//loop through all fields
for ($i = 0; $i < $num_fields; $i++) {
//get field name
$fldName = mysql_field_name($result, $i)];
//get field value
$fldValue = $row[$fldName];
//create html string
$html = $fldName . ": " . "<input type="text" name="" . $fldName . "" value="" . $fldValue . ""><br><br>";
echo $html;
}
} ;

[/code]
Copy linkTweet thisAlerts:
@mikeyzcauthorMar 01.2004 — [i]Originally posted by Michel_v_Duijse [/i]

[B]I'll skip the database part here, if you need that as well, let meknow.



What you can do, is loop through a sql resultset and create a textbox/checkbox andso for every row you have.

You'll have to write the html code for the textbox inside the loop.

Here an example, to create a textbox:

[code=php]
//get the fieldcount
$num_fields = mysql_num_fields($result);
while ($row = mysql_fetch_array($result)) {
//loop through all fields
for ($i = 0; $i < $num_fields; $i++) {
//get field name
$fldName = mysql_field_name($result, $i)];
//get field value
$fldValue = $row[$fldName];
//create html string
$html = $fldName . ": " . "<input type="text" name="" . $fldName . "" value="" . $fldValue . ""><br><br>";
echo $html;
}
} ;

[/code]
[/B][/QUOTE]


awsome..thanks for the help. I'm basically taking this medical laboratory software and making a web based version. the software will be pulling up patient info then ordering blood tests for them, which is why I'll need to create multiple checkboxes on the fly(one for each test) depending on the type.
×

Success!

Help @mikeyzc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...