Jump to content

Arbu

Members
  • Content Count

    33
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Arbu

  • Rank
    Newbie

Recent Profile Visitors

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

  1. I think I've got it. You have to specify type="button" for the button. Otherwise it's treated as if the type were "submit".
  2. Er, that's not so good because then none of the data is set to the server. But if I don't have it, the form seems to get submitted before the Paypal instructions are completed. I'd really like to understand what the trigger is for submitting the form. I had thought that it would be done by the user clicking a button with type="submit". But my button doesn't have this type. So what on earth is the trigger? Is it just the fact of hiding the form?
  3. The instructions I was using to do this are now in "quality review" (https://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL) so I guess I'll have to start again with another set of instructions. It seems incredibly complicated for something that many websites seem to do without any problems.
  4. OK thanks. So the file which includes it does so, as I say, at the beginning, and it contains an html form. Once the user has completed the form and pressed "Submit", the data gets sent to the server. I then want register.inc.php to be run using that data. So it seems that the include statement is placed in a completely inappropriate place in the file. register.inc.php should only be included after the form has been submitted. Otherwise the data won't be there. Should it be included in the form's onsubmit property perhaps?
  5. I've got some code which looks like this: <?php if (isset($_POST['username'],$_POST['first_name'],$_POST['surname'], $_POST['email'], $_POST['p'])) { // Sanitize and validate the data passed in... in a file called register.inc.php. The only references to this file are include_once 'includes/register.inc.php'; in the opening lines of a couple of other files. What is puzzling is just how the php condition gets called. Is it called continuously, so that as soon as the variables have been set, it triggers? Or is it called when the page that includes it is loaded? Whatev
  6. OK, I added this into the form declaration, and it seems to fix it: onsubmit="return false"
  7. Hmm, if I type the code from showpaypal() into the chrome console and execute the lines one by one it all works well. But I'm still getting the same problem with calling this function on the page- the paypal div shows for an instant and then the form details reappear.
  8. 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="
  9. 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
  10. 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.
  11. 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 {
  12. 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.
  13. 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?
  14. var data = encodeURIComponent(formattedJSON()); seems to fix the problem.
  15. 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");
×
×
  • Create New...