Jump to content
#StayAtHome ×

zer0uk

Members
  • Content Count

    21
  • Joined

  • Last visited

Community Reputation

0 Neutral

About zer0uk

  • Rank
    Member
  1. Haha thank you i'll give that a go ..
  2. looks great how do i add that to my file please (not done any java )
  3. but also how do i automatically get the user name to generate from the other two fields ?
  4. so that the user can see (and make a note of the username) but not amend/change
  5. Hi all, could you please tell me how i can get the username on this form to be ghosted out and the content to be the product of Firstname+Surname boxes? <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,minimum-scale=1"> <title>Register</title> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css"> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> </head> <body> <div class="register"> <h1>Register</h1> <div class="links"> <a href="index.php">Login</a> <a href="register.html" class="active">Register</a> </div> <form action="register-with-activation.php" method="post" autocomplete="off"> <label for="firstname"> <i class="fas fa-user"></i> </label> <input type="text" name="firstname" placeholder="Firstname" id="firstname" required> <label for="Surname"> <i class="fas fa-user"></i> </label> <input type="text" name="surname" placeholder="Surname" id="surname" required> <label for="username"> <i class="fas fa-user"></i> </label> <input type="text" name="username" placeholder="Username (This will be displayed)" id="username" required> <label for="password"> <i class="fas fa-lock"></i> </label> <input type="password" name="password" placeholder="Password" id="password" required> <label for="cpassword"> <i class="fas fa-lock"></i> </label> <input type="password" name="cpassword" placeholder="Confirm Password" id="cpassword" required> <label for="email"> <i class="fas fa-envelope"></i> </label> <input type="email" name="email" placeholder="Email" id="email" required> <div class="msg"></div> <input type="submit" value="Register"> </form> </div> <script> $(".register form").submit(function(event) { event.preventDefault(); var form = $(this); var url = form.attr('action'); $.ajax({ type: "POST", url: url, data: form.serialize(), success: function(data) { $(".msg").text(data); } }); }); </script> </body> </html>
  6. Hello I have moved my web site from local machine to a hosted server (Ionos) I seem to be having issues with any code that has redirects or checks if the user is logged in, I just get a blank page, any idea's ? works fine on my local Xamp version two examples below (if I remove the code the page runs) // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } ?> <?php // database connect include('../db_connect.php'); // We need to use sessions, so you should always start sessions using the below code. session_start(); // If the user is not logged in redirect to the login page... if (!isset($_SESSION['loggedin'])) { header('Location: login.php'); exit(); } // if submit button selected run code if(isset($_POST['submit'])){ $_SESSION['district'] = $_POST['district']; header('Location: add_d_choice.php'); } ?> <!DOCTYPE html> <html> <head> </head>
  7. Basically its part of my membership system so the system is checking how many record the user has if its more than so many they will be denied access to add another record. using ['COUNT(*)'] fixed the issue but if anyone wants to show me the correct way of doing this and without the loop id appreciate the learning.
  8. Thanks for your reply makes sense but how to I create an alias then? Could only get this working using the code I've used do realise that their is no need for a loop, feel free to show me what I should be doing .. only been doing this for a month so learning ... Thanks for your help.. appreciated
  9. I ran the SQL in the console and it returns 14
  10. Hi please can someone set me right, the below code isn't working I get an error "Undefined offset: 0" example below is the problem code with error (2nd example works fine) // check how many rides user has done $resultset = $conn->query("SELECT COUNT(*)FROM tbl_rides WHERE username_id = 12"); while($row = $resultset->fetch_assoc()) $var_l_rides=$row[0]; $resultset = $conn->query("SELECT `gold`FROM tbl_accounts WHERE id = 12"); while($row = $resultset->fetch_assoc()) $var_prem=$row['gold'];
  11. Thanks for the replies ..... I don't get an error anymore 🙂 but the drop down box (which the code populates from db.) no longer appears so somethings up !! 😞 remove the code and hardcode "J" ... code works and the drop down list is populated with results filtered by "J" so I now have ... 1st pic code , 2nd pic code of working code div class="row s2 m2 l2"> <div> <label for="course_id">Choose the course raced:</label> <select name="course_id"> <?php // query to create course_id dropdown $resultset = $conn->query("SELECT `course_id`,`course_name` FROM `tbl_courses` WHERE `district`= {$_SESSION['g_district']} "); while($row = $resultset->fetch_assoc()) { echo "<option value='" . $row['course_id'] . "'>" . $row['course_name'] . "</option>"; } ?> </select> <div class="row s2 m2 l2"> <div> <label for="course_id">Choose the course raced:</label> <select name="course_id"> <?php // query to create course_id dropdown $resultset = $conn->query("SELECT `course_id`,`course_name` FROM `tbl_courses` WHERE `district`= 'J' "); while($row = $resultset->fetch_assoc()) { echo "<option value='" . $row['course_id'] . "'>" . $row['course_name'] . "</option>"; } ?> </select>
  12. please can you help .. I'm passing a value from another page using $_SESSION and trying to then use it in a SELECT statement in SQL think I'm missing something ... if hard code the value it works , and I have also checked at the other end that the variable is being assigned ... code is (its the = $_SESSION['g_district'] "); that's causing the issue I'm getting Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /Applications/XAMPP/xamppfiles/htdocs/mytimekeeper/add/add.php on line 170 in the browser <div class="row s2 m2 l2"> <div> <label for="course_id">Choose the course raced:</label> <select name="course_id"> <?php // query to create course_id dropdown $resultset = $conn->query("SELECT `course_id`,`course_name` FROM `tbl_courses` WHERE `district`= $_SESSION['g_district'] "); while($row = $resultset->fetch_assoc()) { echo "<option value='{$row[course_id]}'>{$row['course_name']}</option>"; } ?> </select>
  13. Figured this out now, was actually a lot easier than I thought .... learning 🙂
  14. Thanks for your reply so tbl_rides has a column "username_id" which has a FK to a table tbl_accounts.id the table holds the id, username, password, email tbl_account was the table used for registration and $_SESSION using column username
×
×
  • 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.