Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

and180y

@and180y
About
Posts
39
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Http 500 error with register page
    A and180y

    Hi Richard, thanks. :) Everyday is a school day dealing with the humans I do. :)

    Database help database question

  • Http 500 error with register page
    A and180y

    Thanks Richard, progress made. There is no error as such, if you try to register with the same email twice (yes I thought that as well) it throws the error I mentioned but isn't telling them the email is already registered. It does for username but the email was the bit I added in. :-)

    Database help database question

  • Http 500 error with register page
    A and180y

    Thanks Richard, I edited as you said the other night but wonder if my issue is somewhere in here?

    if(empty($_POST["email"])){
    $email_err = "Please enter your email.";
    } elseif(strlen(trim($_POST["email"])) < 6){
    $email_err = "email must have at least 6 characters.";
    } else{
    $email = trim($_POST["email"]);
    }
    }

    Database help database question

  • Http 500 error with register page
    A and180y

    Richard, is there an error log generated somewhere for the DB? I get an intermittent fault (loads of folk saying the can't register but I can see some are able to) This is the error that shows on the form so not of much use. lol "Something went wrong. Please try again later".

    Database help database question

  • Http 500 error with register page
    A and180y

    Working perfect now. Thanks Richard. :)

    Database help database question

  • Http 500 error with register page
    A and180y

    I have played around starting again from the basic code and adding in what I need and checking for errors, all is fine till I put the code below in.

     }
    
    // Validate email
    if(empty(trim($\_POST\["email"\]))){
        $email\_err = "Please enter your email.";     
    } elseif(strlen(trim($\_POST\["email"\])) < 6){
        $email\_err = "email must have at least 6 characters.";
    } else{
        $email = trim($\_POST\["email"\]);
    }
    
    Database help database question

  • Http 500 error with register page
    A and180y

    Thanks for replying Richard. :) I've fixed those errors but still having the same issue, it loaded the form once but now just a white page with the error.

    Database help database question

  • Http 500 error with register page
    A and180y

    Thanks for replying ZurdoDev. :) I was thinking it had to be something in the prepared statement that I have done wrong but can't figure it out. I ran a query to create the table and columns so assume that must be correct?

    Database help database question

  • Http 500 error with register page
    A and180y

    Hi Could anyone help me with the following code? It was working fine until I inserted a username column in the DB table and edited this to suit (I thought) It gives an HTTP500 error page not working.

    Database help database question

  • Data from one page to another with a twist.
    A and180y

    Thanks Richard, I think I confused you there. Sorry. So once the inputs are pulled from the 1st page to the 2nd and put into the dropdown I either need to call them somehow so as to use them in a calculation or just have them somewhere else so that when eg level 1 is selected (and showing) all the figures in my form would have £10 added to them (the maths part of that is what you have given me knowledge on before so I should get that once I get the numbers) Thanks again. :)

    JavaScript database com data-structures tools question

  • Data from one page to another with a twist.
    A and180y

    Richard, thankyou so much it, works. It shows as per the example 10,20,30 in the drop down. I assume it would be difficult to show the level and value or just the level and the value somewhere else(hidden) so that the values can get used in the calculations? I know I could do that in Excel but I'm still at the start of the learning curve here. :)

    JavaScript database com data-structures tools question

  • Data from one page to another with a twist.
    A and180y

    Thanks Richard, I'm thinking it's probably me as the code below still gives me nothing. Assuming it should post to the dropdown I already have?

    const searchParams = new URLSearchParams(location.search);
    for (const [key, value] of searchParams) {
    let element = document.getElementById(key);
    if (element) {
    element.value = value;
    }
    else {
    console.warn("Unknown element:", key, element);
    }
    }

    JavaScript database com data-structures tools question

  • Data from one page to another with a twist.
    A and180y

    Thanks Richard, this is how the inputs and the dropdown are laid out but can be changed if it makes it easier to get to the result I need. :) I have tried the code you have given me but still nothing in the dropdown. (All I get is level 1, level 2 etc)

    Payrate

    Level 1

    Level 2

    Level 3

    Level 4

    Level 5

    Level 6

    level-1
    level-2
    level-3
    level-4
    level-5
    level-6

    JavaScript database com data-structures tools question

  • Data from one page to another with a twist.
    A and180y

    Hi Richard, thanks for replying. When I input the data and press the submit button it correctly forwards me to this page; overheads5.html?level-1=10&level-2=20&level-3=30&level-4=40&level-5=&level-6= so the data is in the url but I can't get it from there into the dropdown to use in calculations. Basically the idea is that other data in the destination page has the value in the drop down added to it. Would it help to show you the actual pages?

    JavaScript database com data-structures tools question

  • Data from one page to another with a twist.
    A and180y

    I have a page where values (monetary) are entered into boxes and the aim is to have them appear in a drop down list on the next page. I have searched and found this Transferring page values to another page[^] But wondered if there was a more upto date way of doing it? I have the code below and whilst I can send the data to the URL the script doesn't put it in the drop down. I've read about doing it with cookies, is that a more reliable method?

    //get the value of each field
    from the url as a query string
    var query = location.search;
    var splitQuery = []; var value
    = [];

    function parseQuery(query){

    /*check if there are
    mutiple value (querystring in
    url are seperated with &), and
    store them to an associative
    array*/

    if(query.search(/[&]/)){
    splitQuery = query.split('&');

    /*split again and target drop
    down*/

    for (var x = 0; x <
    splitQuery.length; x++){
    var splitEach =
    splitQuery[x].split('=');

    document.getElementsByClassName
    ('dropdown')[x].textContent =
    splitEach[1];
    }
    }
    }
    parseQuery(query);

    JavaScript database com data-structures tools question

  • Javascript function error.
    A and180y

    Thanks Richard, you were right. In my haste I lost focus. :)

    JavaScript javascript html help question

  • Javascript function error.
    A and180y

    Jkirkerx, not sure why but your post vanished. I tried it but no luck. Going to change a few things so will keep you updated, thanks for your help thus far. :)

    JavaScript javascript html help question

  • Javascript function error.
    A and180y

    Have added some more elements (not in use at present) but still not getting the breakeven to calculate.

    <div class='col-sm-2 mb-1'>
    <input type='number' id='time' class='form-control' data-calc='time' placeholder='Minutes Allocated' tabindex='2'>
    </div>
    <div class='col-sm-2 mb-2'>
    <input type='text' id='current' class='form-control form-output' data-calc='current' value='£0.00' tabindex='-1'>
    </div>
    <div class='col-sm-2 mb-2'>
    <input type='text' id='breakeven' class='form-control form-output' data-calc='breakeven' value='£0.00' readonly tabindex='-1'>
    </div>
    <div class='col-sm-2 mb-2'>
    <input type='text' id='tier1' class='form-control form-output' data-calc='tier1' value='£0.00' readonly tabindex='-1'>
    </div>
    <div class='col-sm-2 mb-2'>
    <input type='text' id='tier2' class='form-control form-output' data-calc='tier2' value='£0.00' readonly tabindex='-1'>
    </div>
    </div>

    <button type="button" onBlur="calcTime()">Calculate</button>
    

    function calcTime() {

    // Make references to input elements
    const time = document.getElementById("timeAllowed"),
    current = document.getElementById("currentCharge"),
    breakEven = document.getElementById("breakEven"),
    tier1 = document.getElementById ("tier1"),
    tier2= document.getElementById ("tier2");

    // Get the element values, convert to number/float
    // By default, values are strings, and don't do math well.
    let t = parseFloat(time.value);
    let c = parseFloat(current.value);

    // Perform the equation
    let bE = t * c;

    // Output the equation
    breakEven.innerHTML = bE.toString();

    }</pre></x-turndown>

    JavaScript javascript html help question

  • Javascript function error.
    A and180y

    Sorry, I think I deleted my reply just as you replied to it. :sigh: :doh: :doh:

    JavaScript javascript html help question

  • Javascript function error.
    A and180y

    Where's the best place to learn how to write functions and class functions. I've ran through the courses Richard suggested above but none seem to be taking me where I need to be or am I trying to walk before I can run? :-) To me this should run but it's not returning a value, (or I'm not grasping how to get it to do so)

    $(function(){
    $("#current-charge").keyup(function(){
    var time = $("#time-allowed").val();
    var current = $("#current-charge").val();
    $("breakeven").html(time * current);
    })
    })

    JavaScript javascript html help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups