Jump to content

FoxfireTX

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About FoxfireTX

  • Rank
    Newbie
  1. Justsomeguy, I'm trying to understand what you are saying. I did not start with this code, I started with things in appropriate "" but the server kept giving me errors. I was stunned with what I got back when I uploaded. As I noted previously, when I first uploaded it was clean on my localhost and in netbeans but the server would not read it. In my first variable, I now have it defined as :/ / define variables $firstname = $_POST[firstname]; I only have that because I got error messages with it in either double or single quotes. It made no sense to me as that was the way I had d
  2. I was WRONG! Dsonesuk you GOT it! Forgot to change the database name, and taking out that extra space did it! Also tried it on the server and it inserted. I cannot thank you enough, as well as everyone who tried to help! Thank you, thank you!
  3. Extra space? Just tried taking that out, and still nothing but a page of warnings with this code on my localhost, did not insert the data: if (isset($_POST[firstname], $_POST[lastname], $_POST[email], $_POST[phone])) { if ($stmt = $link->prepare('INSERT INTO `volunteerstest`(`firstname`, `lastname`,`email`, `phone`) VALUES (?, ?, ?, ?)')) { $stmt->bind_param('ssss', $_POST[firstname], $_POST[lastname], $_POST[email], $_POST[phone]); if (!$stmt->execute()) { error_log('Execute failed '.$stmt->error); } else { echo 'Data successfully
  4. So you don't think I am totally out of my mind, this is the statement I just received from the server taking that same INSERT into language down to 3 columns rather than the 4 or more: Data successfully inserted! + the data listing And the same code, taken down to three variables: if (isset($_POST[firstname], $_POST[email], $_POST[phone])) { if ($stmt = $link->prepare('INSERT INTO `volunteerstest`(`firstname`, `email`, `phone`) VALUES (?, ?, ?)')) { $stmt->bind_param('sss', $_POST[firstname], $_POST[email], $_POST[phone]); if (!$stmt->execute()) {
  5. That's where I started Saturday, and that is what would NOT run when I uploaded the pages to the server. I ended up debugging by one line at a time, and uploading again for the next line. At the moment, when I try to go from inserting 3 columns of data to 4 columns, this is the error message from the server: Parse error: syntax error, unexpected ',' in /.../volunteers3remote.php on line 124 And this is the code starting with line 124, which is the INSERT INTO section: Line 124 if (isset($_POST[firstname], ($_POST[lastname], $_POST[email], $_POST[phone])) { if ($stmt = $link
  6. These are the page full of warnings I get in NetBeans and on my local host when I get it to run on the server: " Warning: Use of undefined constant firstname - assumed 'firstname' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\volunteers3local.php on line 130" And these are the type of messages I get on the server if I heed the warnings in NetBeans and on my localhost: "Parse error: syntax error, unexpected 'mail' (T_STRING) " and it will NOT insert the data. To get the sample that works to actually insert the data, I basically changed every " to ' an
  7. This is the full code that will insert data: <?php ini_set('display_errors', '1'); ?> <?php // 1. Create connection to database define('DB_NAME', ''); define('DB_USER', ''); define('DB_PASS', ''); define('DB_HOST', 'localhost'); $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); if (!$link) { die('Could not connect to database: ' . mysqli_error()); } // define variables $firstname = $_POST[firstname]; $lastname = $_POST[lastname]; $email= $_POST[email]; $zip= $_POST[zip]; $phone= $_POST[phone]; $house_party= $_POST[house_party]; $canvass= $_POST[canvass]; $p
  8. dsonesuk, that is where I started but it will not run that way on the server. Throws a page full of error messages. That is why I ended up debugging line by line on the server to get it to insert data. It makes zero sense to me.
  9. OK, so I went back, copied the INSERT INTO exactly from the one this working into a new doc, and went from the 10 columns of data to just the 4 required (firstname, lastname, email, phone) and adjusted the other things accordingly, but got this error message both on the server and on local host: " Parse error: syntax error, unexpected ',' in on line 124". So I then went back and stripped it down to three columns, firstname, email phone, and it inserted on my local host along with a page full of these messages, which I've come to expect to get it to write into the database on the server
  10. I should note further, we were under tight timelines initially to get the website up and running so I just used the send email function to capture the data in some way at this point. I have a niece who works with SQL every day so she has since set up the database and tables, and now the goal is to get the data to insert into the database for future use so it doesn't have to be added manually. Thanks!
  11. The warnings in netbeans relate to filtering and not accessing Global array directly. None of what it is happening when I upload to the server makes sense to me. I can run the code on the website portion of the server and it runs correctly without warnings. But when I try to insert data into a table on the SQL side, I get all kinds of warnings about single versus double quotes, etc. As I noted, I debugged the first test line by line on the server itself to finally get it to insert the data. This is the code that IS inserting data on the server now. It was clean on my localhost and netbea
  12. I am new to php and am having a real problem getting it to write to SQL tables from form input. I finally managed to get a 3 column test form to insert the data into a test table, so moved on to the next test of inserting a 10 column form that includes 4 check boxes following the script of the one I got to insert. But I cannot get it to insert the data. I also have the problem that my localhost is running php 7.1 while the SQL side of the server is using php 5.6, thus the many single quotes versus double quotes or no quotes. With the first test script, I debugged line by line, and figured
×
×
  • Create New...