Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Arbu

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm trying to set up a registration form with Paypal payment. Once all the data has been entered and verified in the form, the registration form should be hidden and the Paypal form show. But the Paypal form only shows for two seconds before the registration form reappears. What am I doing wrong? I attach code below. Also, I don't understand the lines in regformhash which someone else has written for me. It seems that you can return multiple instructions in one line in a function. But what does the false at the end of each line do? Where does it get picked up? Thanks. <form class="
  2. w3 schools says "Python can be used on a server to create web applications." and wikipedia says "Examples of commonly-used, web applications, include: web-mail, online retail sales, online banking, and online auctions.". But why do you need an application on the server to access these things? Surely the information is just held in a database or as variables which you can access with PHP and AJAX? What does Python add? I thought that a web application was something like Google Docs - something that is like a computer program but which you run in your browser. But would that actually
  3. Arbu

    Can't update SQL record.

    I'm already saving files with much the same code, and that works OK. So I don't think there was an issue with not using prepared statements. What now seems to have fixed it however is simply placing single quote marks around $data in $sql.
  4. I'm getting an error when I try to update a record in my sql database. Here's my code: function updateRecord($mysqli,$diagram_id,$data,$image){ if(login_check($mysqli)){ $sql = "UPDATE diagrams SET data=$data WHERE id=$diagram_id"; if ($mysqli->query($sql) === TRUE) { // echo "Record updated successfully"; //header("Location: ../account.php"); echo "Success"; exit(); // return true; } else { echo "Error: " . $sql . "<br>" . $mysqli->error; // return false; } $mysqli->close(); exit(); } else {
  5. Yes, there are loads. It seems that if I remove the single quotes around the php command the error goes away. I don't actually understand why they were there in the first place.
  6. I'm using this code <?php if (isset($_POST["json"])) : ?> loadfile('<?php echo $_POST["json"] ?>'); <?php endif; ?> to insert a command into my scrjavascript script and it appears like this: loadfile('{ ... ... }'); But I get a message for the loadfile line "Uncaught SyntaxError: Invalid or unexpected token". I can't see anything wrong. Why am I getting this error?
  7. var data = encodeURIComponent(formattedJSON()); seems to fix the problem.
  8. I'm sending some information to the server with AJAX: function saveFileToAccount(filename){ /** [Storing JSON representations of the canvas] */ var data = formattedJSON(); /** [Store preview of transaction diagram] */ var image = canvas.toSVG(); var xmlhttp = new XMLHttpRequest(); var sendstring = "filename=" + filename + "&json=" + data + "&image=" + image; xmlhttp.open("POST", "includes/process_save.php", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  9. OK, setting my display items for the login status wasn't too hard. I don't need an AJAX request to find out; I can just set a variable with php on loading the page. The problem I'm running into now is that, if the user enters the wrong login details I'd like the login form to remain in place so that I can give him a notification to that effect and he can try to enter in again. But by the time the code gets to hashandlogin, the login form has already gone. I tried removing data-iziModal-close from the submit button and closing the loginform manually if the login details were correct, but
  10. At the moment I have the following. But I need to update the page to show whether the user is logged in (a) on loading and (b) when he logs in. So I'm thinking that I need to make an AJAX request in $(document).ready to see if he is logged in, then have a js function to set the details on the page that I can call from there and also when he logs in and out. I don't know if there's some way to have php simply send the log in details when the page is loaded. <?php if (login_check($mysqli) == true) : ?> <p>Welcome <?php echo ucwords(htmlentities($_SESSION['userna
  11. OK, thanks very much, it seems to work OK now. I've gone with using POST rather than GET because I wasn't sure if I'd need to change INPUT_POST if I used GET. Hopefully sorting out the display at the browser end should be reasonably straightforward now. function hashandlogin(a, b) { formhash(a, b); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(this.responseText); } }; var sendstring="email=" +document.getElementById("login_em
  12. OK, good point, I hadn't noticed that that was there. So I've taken it out and now the page doesn't refresh. Hooray! The next thing is to get the data that I send to the server to be recognised. Naturally this doesn't work first time. I don't think that the server is actually finding the data that I send. Here's my code using the post method: function hashandlogin(a, b) { formhash(a, b); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { console.log(this.res
  13. Yes, but as I say, regardless of whether I have type=submit or not, the event.preventDefault never gets triggered. If I can fix that I'll have a go at putting my AJAX code in the curly braces with that. But otherwise there's no point in trying that.
  14. OK here's my code now. I believe there should be a question mark after process_login.php not a full stop as you have it. Anyway I'm getting told that the post data is not set correctly. <?php if (login_check($mysqli) == false) : ?> <div id="loginform" data-iziModal-group="grupo1"> <button data-iziModal-close class="icon-close">x</button> <!--watch out here - JSFormat formatted the izimodal spec to have spaces in it and the button no longer worked.--> <header> <a href="" id="signin">Sign in</a&g
  15. Should it be the "submit" event or the "onsubmit" event. In any case I can't ever get the event.preventDefault() to trigger. If I set a break point there it doesn't get caught. If I take out the onclick property then still it doesn't trigger. I'll keep working on how to access the email and password from the form.
  • Create New...