Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A few things:</p> <ol> <li>This doesn't sound like a log; it sounds like a file-based database.</li> <li>If allowed, use a .csv file (not .txt) and parse it using <a href="http://php.net/manual/en/function.fgetcsv.php" rel="nofollow">fgetcsv()</a>.</li> <li>Since it's your database you'll need to write to it. You can use <a href="http://php.net/manual/en/function.fputcsv.php" rel="nofollow">fputcsv()</a> for that.</li> </ol> <p>(FWIW, your .txt file is already a csv, you're just not treating it that way.)</p> <p>Per the specific question: Clicking "Book" just needs to pass the Course Name to a script that will add the current user to that course (if they haven't already registered). You can pass the course name using POST (HTML forms) or, more simply, GET (links and query parameters).</p> <p>Using links (GET) might look like this:</p> <pre><code> $bookingUrl = "register.php?courseName=".urlencode($courseName); </code></pre> <p>Using a form (POST) might look like this:</p> <pre><code> &lt;form action="register.php" method="POST"&gt; &lt;input type="hidden" value="&lt;?= $courseName; ?&gt;" /&gt; &lt;input type="submit" value="Book" /&gt; &lt;/form&gt; </code></pre> <p>Another answer mentioned using separate files to track registrations per course, but I don't think that's necessary; just use one. It's helpful to think of what you're really tracking:</p> <ol> <li>Available Courses, "courses.txt": Course Name, Course Time (got it)</li> <li>Users, "users.txt": Username, Password (got it)</li> <li>Registrations, "registrations.txt": Username, Course Name (don't got it)</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload