Reply
Old 06-10-2014, 10:05 PM   #1 (permalink)
 
Status: Junior Member
Posts: 3



Default php html question

So I'm working on making a simple Web application using html and PHP for the backend (was using PERL but I don't understand it enough to continue, and I can't find much useful help either)



Here is what I'm trying to do.

On a intranet network, a user clicks a link that brings them to a new page that has many items listed as links to another Web page which is the same (buts needs to be altered in some aspects) for each link. For example:the Web page with all the links needs to load with the number of options in a database. If a new option is added to the database, then a reference needs to be made with the value in the cell. Then a user clicks "option one", which brings up that new constant Web page and a label is named "option one" in that new form. If someone clicks option 2 on the links page, then the new form needs to open with the label saying "option two" etc etc.

The new form that opens is just one html file, but a label needs to change depending on which hyperlink on the previous page is selected.

So, my questions are:
1) how can I make a form open dynamically with additional option links if an option is added right to the database?

2) how can I make a label change and use the same text as the text used in the hyperlink from the previous page?

I know a fair amount of html, and can do research on PHP.. I'm just struggling with these two questions. Any help is appreciated. If you'd rather email me about it, my email is bowlingkingpin18@yahoo.com
newbeardieowner is offline   Reply With Quote
Old 06-10-2014, 10:05 PM   #2 (permalink)
Nik
 
Status: Senior Member
Posts: 284



Default php html question

<?php
include("db.php"); // Another PHP file which has your database connection details
$sql = "select * from table"; // main query. Will select the entire table contents.
$result = mysql_result($sql);
$count = mysql_num_rows($result); // Count the rows returned

if($count > 0) // If rows detected carry on
{
$r = 0;
while($r < $count)
{
$field0 = mysql_result($result, $r, "table column"); // Retrieve column contents
$field1 = mysql_result($result, $r, "table column"); // Retrieve column contents
$field2 = mysql_result($result, $r, "table column"); // Retrieve column contents

echo "<a href=\"".$field0."\">Option One</a>"; // echo link list
$r++;
}
}
?>

----------------------------

This code is very vague its a general outline what would happen is as long as the table is being populated the links would be echoed to co inside with the database results. 20 links in the database means 20 links on the web page. You would simply replace the links with option inputs for the form. Which would result in an automatic updating select input.

// there are comments in the code comments follow "//" double slash
Nik is offline   Reply With Quote
more..
Old 06-10-2014, 10:05 PM   #3 (permalink)
 
Status: Senior Member
Posts: 453



Default php html question

1) how can I make a form open dynamically with additional option links if an option is added right to the database? You can't open a form dynamically. Because forms are made static with a mark up language such as HTML.

You can send data from a form to a database. The data you send can't change your form. Because your form would be made with a mark up language such as HTML.
Franco is offline   Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
*Help* PHP vs HTML Question. If I use PHP instead of HTML will it affect my website traffic? Unknown_User PHP Code/ PHP Codes 0 08-31-2012 11:36 AM
I have a question about HTML and Tumblr. What is the proper HTML code to insert a text and link combined? Unknown_User Html Code/ Html Codes 1 06-24-2012 04:05 PM
Html Question/Html Code Question? Unknown_User Html Code/ Html Codes 2 06-14-2012 11:05 AM
html need help... advanced question on html tags (bold)... Aducceext Html Code/ Html Codes 0 09-26-2011 09:05 AM
Hard html question, 6 strings of the html-code. Why child auplidlivel Html Code/ Html Codes 0 07-27-2011 12:06 AM