Jump to content

34drysdale

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

34drysdale's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yes, it will query the database and print a table in pages. I have data in sqlite db, but don't know how to code in PHP. I just started learning PHP last week and am not a programmer. I want to do something like when a user click to view bookings, the tool will show up 4 weeks view starting from the current week and click on next page will show the next 4 weeks, something like that. Thank you!
  2. We have booking data in spreadsheet looks like table in below, and each booking is for a full week. | wk1 | wk2 | wk3 | wk4 | wk5 |..........| wk52 | ================================== E1 | resv | |resv | |resv | |resv E2 | | resv |resv |resv | E3 | resv | resv |............................................... E4 | resv | E5 | ... | resv | resv|.................................... ... | E50|resv | resv | | resv It looks great excel but required one person to manage all bookings. So we moved to web interface and allow users to make their own bookings. Now, data moved to sql database with fields (id, wk#, room, other....), and records like below. 01 wk1 E1 02 wk1 E3 03 wk1 E4 ..... etc.... nn wk2 E2 nn wk2 E3 ... and more Now, I need a method in PHP to print above data in HTML table that looks like excel table in above. It doesn't have to print 52 wks in one page, but at least something like 4 wks view and next page to show the next 4 wks. At start it will print the first 4 wks from the current week (wk 11), and next page will print wk12 to wk15, etc. | wk1 | wk2 | wk3 | wk4 =================== E1 | resv | |resv | E2 | | resv |resv |resv E3 | resv | resv |............... E4 | resv | E5 | more rows...... Can someone here give me a direction how to code this in PHP? Thank you very much! bobo
  3. Guys, thanks. It's my coding problem. I missed the name of input at second elseif statement.
  4. Yes when load the script, it just prints for Location (valid) and click on "Next 1", it then prints Location (with previous selected info) and Instructor for selection. Select instructor and click on "Next 2", it should prints Location & Instructor with previous selected info, right? But the script jumps back to the beginning and just prints the Location with no selected info even the last elseif changed to else. So, the problem is it doesn't pass Location and Instructor at the second click on "Next 2" button. Thanks, bobo
  5. Hi everyone! I'm new to PHP and needed from you. I have the following code that I can't figure out why it doesn't work on the last elseif. If I comment out the first elseif (line 19-39), it does go through the last elseif. Can someone here help? Thank you!!! The content of Instructors.txt as follow: ID#|fName lName|email_address|course1:course2:course3 ID#|fName lName|email_address|course1:course3 ID#|fName lName|email_address|course1:course2:course4 ID#|fName lName|email_address|course2:course3:course5:course6 <?php //If we submitted the form if(empty($_POST['Location'])) { $FH = fopen("Locations.txt", "rb"); print "<FORM name=\"myForm\" action=\"test4.php\" method=\"POST\">\n"; print "<P> Location:\n"; print "<select name=\"Location\">\n"; print "<option value=\"\">-- Select --\n"; while (!feof($FH)){ $line_of_text = fgets($FH); $line = explode('|', $line_of_text); print "<option value=$line[1]>$line[1]"; } fclose($FH); print "<input type=\"submit\" value=\" Next 1 \">\n"; exit(); } elseif(empty($_POST['Instructor'])) { $location = ($_POST['Location']); $FH = fopen("Instructors.txt", "rb"); print "<FORM name=\"myForm\" action=\"test4.php\" method=\"POST\">\n"; print "<P> Location: <input type=text value=$location>\n"; print "<P> Instructor: \n"; print "<select name=\"Instructor\">\n"; print "<option value=\"\">-- Select --\n"; while (!feof($FH)){ $line_of_text = fgets($FH); $line = explode('|', $line_of_text); if ($line[0] == "$location") { print "<option value=\"$line[1]\">$line[1]\n"; } } fclose($FH); print "<input type=\"submit\" value=\" Next 2 \">\n"; exit(); } elseif(empty($_POST['Course'])) { $location = ($_POST['Location']); $instructor = ($_POST['Instructor']); $FH = fopen("Instructors.txt", "rb"); print "<FORM name=\"myForm\" action=\"test4.php\" method=\"POST\">\n"; print "<P> Location: <input type=text value=$location>\n"; print "<P> Instructor: <input type=text value=\"$instructor\">\n"; print "<P> Course: \n"; print "<select name=\"Course\">\n"; print "<option value=\"\">-- Select --\n"; while (!feof($FH)){ $line_of_text = fgets($FH); $line = explode('|', $line_of_text); if ($line[1] == "Bert Vandenber") { $course = explode(':', $line[3]); for ($i=0; $i<count($course); $i++) { print "<option value=\"$course[$i]\">$course[$i]\n"; } } } fclose($FH); print "<input type=\"submit\" value=\" Next 3 \">\n"; exit(); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.