Jump to content

JoshEir

Members
  • Posts

    30
  • Joined

  • Last visited

About JoshEir

  • Birthday 05/02/1973

Profile Information

  • Gender
    Male
  • Location
    Virginia
  • Interests
    Programming, Server Side, C++
  • Age
    47

Recent Profile Visitors

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

JoshEir's Achievements

Member

Member (2/5)

1

Reputation

  1. Well, I have narrowed down the code so that it is evident that it is in the html string. Because of this, I should be able to find the bug, Thanks!
  2. I do want the decimals to work as well. I'm no guru either, but because keyword1 is a variable it won't work with quotes. As far as PHP is concerned This seems to be the last question for my ecommerce site project. Next should be Golang with Javascript again. Please help me succeed.
  3. I have the following code which is passing the variables to: SaveProductItems(... unfortunately, the passed values are being set to: "" They do not work with .value or without. I need help please. $imageID = $_GET['imageID']; $fileID = $_GET['fileID']; $descID = $_GET['bdescID']; $title1 = $_GET['title1']; $productID = $_GET['productID']; $titleID = $_GET['btitleID']; $costID = $_GET['bcostID']; $quantityID = $_GET['bquantityID']; $key1ID = $_GET['bkey1ID']; $key2ID = $_GET['bkey2ID']; $key3ID = $_GET['bkey3ID']; $gKeyword1 = $_GET['gKeyword1']; $gKeyword2 = $_GET['gKeyword2']; $gKeyword3 = $_GET['gKeyword3']; $image = $_GET['image']; $description = $_GET['description']; $cost = $_GET['cost']; $quantity = $_GET['quantity']; $category = $_GET['category']; $string0 = " <p id = \"link1\">product id :$productID</p> <div style = \"background-color:#40e0d0;\" class = \"A\" id = \"$mainDiv\"> <center><h1>Added Record<h1></center></p> <div class=\"container\"> <div class=\"row\" > <div class = \"col\"> <iframe id=\"upload_target\" name=\"upload_target\" style=\"width:0;height:0;border:0px solid #fff;\"></iframe> <div class=\"text-left\"> <form target=\"upload_target\" method = \"POST\" action = \"upload2a.php\" enctype=\"multipart/form-data\"> <input type=hidden id=\"$productID\" name= \"productID\" value=\"$productID\"> <!-- <input type=hidden id=\"$filename\" name=\"filename\" value=\"$filename\"> --> <input type = \"file\" name = \"file\" id = \"$fileID\"> <br><br> <button value = \"Submit\" type = \"submit\" >submit it</button> </form> <div id = \"text-left\"> <button onclick = \"imageRefresh( '{$filename}', '{$imageID}')\" >Confirm</button><br><br> </div> </div> <img class=\"NO-CACHE\" width=\"120\" height =\"120\" id = \"$imageID\" src=\"http://localhost/phpproj/uploads/$filename?<?php filemtime('$filename') ?>\">No Image</img> </div> <div class=\"col\"><br><br><br><br> <h4><center><p id =\"\" >Title</p></center></h4> <center><p> <input id = \"$titleID\" value = \"$title1\" type=\"text\" name=\"\" placeholder=\"\"></p></center> </div> <div class=\"col\"> <h4><center><p id = \"\">Desc</p></center></h4> <center><textarea wrap id = \"$descID\" value = \"$description\" name=\"text\" rows=\"5\" cols=\"34\">$description</textarea></center> </div> <div class=\"col\"><br><br> <h4><center><p id = \"\" >Cost</p></center></h4> <center><p> <input id = $costID value = $cost type=\"number\" name=\"title\" placeholder=\"$cost\"> </p></center> </div> </div> </div> <div class=\"container\"> <div class=\"row\" > <div class=\"col\"> <h4><center><p id = \"\" >Quantity</p></center></h4> <center><p> <input id = $quantityID value = $quantity type=\"number\" name=\"title\" placeholder=\"$quantity\"> </p></center> </div> <div class=\"col\"> <h4><center><p id = \"\" >Keyword 1</p></center></h4> <center><p> <input id = \"$key1ID\" value = \"$gKeyword1\" type=\"text\" name=\"title\" placeholder=\"$gKeyword1\"> </p></center> </div> <div class=\"col\"> <h4><center><p id = \"\" >Keyword 2</p></center></h4> <center><p> <input id = \"$key2ID\" value = \"$gKeyword2\" type=\"text\" name=\"title\" placeholder=\"$gKeyword2\"> </p></center> </div> <div class=\"col\"> <h4><center><p id = \"\" >Keyword 3</p></center></h4> <center><p> <input id = \"$key3ID\" value = \"$gKeyword3\" type=\"text\" name=\"title\" placeholder=\"$gKeyword3\"> </p></center> </div> <br><br> </div> </div> <div class=\"container\"> <div class=\"row\" > <!-- the keys are --> <div class=\"col\"> //////////////////////////////////////////// //////////////////Failing funtion call:////// //////////////////////////////////////////// <center><button id = \"\" onclick = \"SaveProductItems( '{$productID}', '{$deleteFlag}', '{$mainDiv}', '{$titleID}', '{$descID}', '{$costID}','{$quantityID}', '{$key1ID}' , '{$key2ID}' , '{$key3ID}' )\">Resubmit</button></center> <center><button id = \"\" onclick = \"deleteRecord(1, '{$mainDiv}', '{$productID}' )\">Delete</button></center> </div> </div> </div> </div><!--mainDiv--> ";//stringend insertNewRecord( $fileID, $filename, $title1, $descID ,$productID, $titleID ,$costID ,$quantityID,$key1ID ,$key2ID ,$key3ID ,$gKeyword1 , $gKeyword2 ,$gKeyword3 ,$image ,$description, $cost ,$quantity , $category ); if (!isset($myObj) && isset($string0)) { $myObj = new stdClass(); $myObj->htmlstuff = $string0; //Encode the data as a JSON string $jsonStr = json_encode($myObj); echo $jsonStr; } And here is the Javascript function that sets the values to "" or [object HTMLTextAreaElement. function SaveProductItems( ProductID, deleteFlag , maindiv, title, desc, cost, quantity, keyword1, keyword2, keyword3){ const element = document.getElementById("dropDown1"); const checkValue = element.options[element.selectedIndex].value; const checkText = element.options[element.selectedIndex].text; var val13 = checkText; //changed these var val1 = document.getElementById(title); var a = val1.value; ////////////////////////////////////////// //////////////PROBLEM HERE:////////////// ///////////////////////////////////////// var val2 = document.getElementById(desc).value; var val3 = document.getElementById(cost); var val4 = document.getElementById(quantity); var val5 = ProductID; var val8 = document.getElementById(keyword1).value; var val9 = document.getElementById(keyword2).value; var val10 = document.getElementById(keyword3).value; //var val11 = document.getElementById(fileID).attributes.value.textContent //var val11 = document.getElementById(fileID).value; //var val11 = $('input[type=file]').val().replace(/C:\\fakepath\\/i, '') //var val14 = category; //var val15 = customerid; if (deleteFlag == 1) { document.getElementById(maindiv).innerHTML = ""; } var xmlhttp = new XMLHttpRequest(); var PageToSendTo = "saveNewRecord.php?"; var UrlToSend = PageToSendTo + "val1=" + val1 + "&" + "val2=" + val2 + "&" + "val3=" + val3 + "&" + "val4=" + val4 + "&" + "val8=" + val8 + "&" + "val9=" + val9 + "&" + "val10=" + val10 + "&" + "val5=" + val5 + "&" + "val13=" + val13 + "&" + /*"filename=" + val11 "&" +*/ "pdib=" + ProductID; xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { } }; xmlhttp.open("GET", UrlToSend , true); xmlhttp.send(); } Thank you for your help, JoshEir
  4. Ahh, thank you! How is England?
  5. That seemed to do it, what was the problem?
  6. Oh, Array ( [1439] => 1439 [A5_png] => A5.png )
  7. Well, as you can see the action is that, however there is an iframe. Any clue?
  8. Still doesn't work, its odd.
  9. I am having trouble with passing values with a POST to another php file. I am getting the error : undefined index : productID and undefined index: filename. I have also tried : <form method = \"POST?pdib=$processID&filename=$filename\" action = \"upload2.php\" > When I look at the array of superglobals, they are both defined. Thank you! Here is the code : drawfirsttwoforms: $sql = "SELECT ProductFilename, ProductName, ProductID, ProductDescription,ProductCost,ProductQuantity, ProductCatTitle FROM products INNER JOIN customers ON customers.CustomerID = products.CustomerID WHERE ((products.ProductKeyWord1 = ?) OR (products.ProductKeyWord2 = ?) OR (products.ProductKeyWord3 = ? )) AND (products.ProductCatTitle = ?) "; $stmt = $dbo->prepare($sql); $stmt->bindParam(1, $keyword1); $stmt->bindParam(2, $keyword1); $stmt->bindParam(3, $keyword1); $stmt->bindParam(4, $titleOfSelectedDropDown); $stmt->execute(); while ($row = $stmt->fetch()) { //these variables do have values here $productID = $row['ProductID']; $filename = $row['ProductFilename']; $string1 .= " <div class = \"A\" id = \"$mainDiv\"> <p id = \"link1\">product id :$productID</p> <p>category id :$category</p> <div class = \"A\" id = \"endz\"></div> <div class = \"A\" id = \"startz\"></div> <div class=\"container\"> <div id = \"testing\" >testing <div> <div id = \"$displayID\" > </div> <div class=\"row\" > <div class=\"col\"> <form method = \"POST\" action = \"upload2.php\" > <input type=hidden id='$productID' name= '$productID' value=\"A\"> <input type=hidden id=\"$filename\" name=$filename value=\"B\"> <button value = \"Submit\" type = \"submit\" >submit it</button> </form> <iframe id=\"upload_target\" name=\"upload_target\" style=\"width:0;height:0;border:0px solid #fff;\"></iframe> <img width=\"120\" height =\"120\" id = \"$imageID\" src=\"../php proj/uploads/$filename?<?php echo filemtime($filename)?>\"> <button onclick = \"imageRefresh( '{$filename}', '{$imageID}', '{$_SESSION["msg"]}' )\" >Display</button> </div> AFTER: if (!isset($myObj) && isset($string1)) { $myObj = new stdClass(); $myObj->htmlstuff = $string1; //Encode the data as a JSON string $jsonStr = json_encode($myObj); echo $jsonStr; } function printHTML1(keyword){ const element = document.getElementById("dropDown1"); //const checkValue = element.options[element.selectedIndex].value; const checkText = element.options[element.selectedIndex].text; var val1 = checkText; var xmlhttp = new XMLHttpRequest(); var keyword1 = keyword; var url = "drawfirsttwoforms.php?keyword=" + keyword.value + "&" + "val1=" + val1; xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var jsonData = JSON.parse(this.responseText); var answerHtml = jsonData.htmlstuff; document.getElementById("codehere").innerHTML = answerHtml; createAndModifyDivs(); } }; xmlhttp.open("GET", url , true); xmlhttp.send(); } upload2.php <?php session_start(); $productID = $_POST['productID']; $filename = $_POST['filename'];
  10. I am having trouble with my phone to set up pay pal. I'll get to it soon.
  11. Thank you, I would never have suspected that! Hence, this error reporting is important, is it an extension? I'm using Visual Code. Josh
  12. I'd love to use anonymous placeholders on my ecommerce site project. I am writing half with php and half with golang. On the three examples below, when run, gives the following exception, " Error: Call to a member function execute() on string. " I tried it with a decimal too. Thanks in advance. $stmt = $dbo->prepare = ("SELECT * FROM products WHERE ProductName = ?"); //this one calls exception $stmt->execute(); $stmt = $dbo->prepare = ("SELECT * FROM products WHERE ProductName = ?"); //this one calls exception $stmt->bindParam(1, $productID, PDO::PARAM_INT); $stmt->execute(); $stmt = $dbo->prepare = ("SELECT * FROM products WHERE ProductName = ?"); //this one calls exception $stmt->bindValue(1, $productID, PDO::PARAM_INT); $stmt->execute(); Here is the rest of the code : <?php $filename = ""; $keyword1 = $_GET['keyword']; $titleOfSelectedDropDown = $_GET['val1']; $fileID = ""; $imageID = "a"; $displayID = ""; $keyword1 = "test"; $titleOfSelectedDropDown = "cc"; $host = 'localhost'; $user = 'root'; $pass = ''; $database = 'ecommerce'; $options = array( PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_EMULATE_PREPARES => false ); $gKeyword1 = ""; $gKeyword2 = ""; $gKeyword3 = ""; $key1ID = ""; $key2ID = ""; $key3ID = ""; $string1 = "<center><h1><u>Search Results</u><h1></center></p>"; $dbo = new PDO("mysql:host=$host;dbname=$database", $user, $pass, $options); $stmt = $dbo->prepare = ("SELECT * FROM products WHERE ProductName = ?"); $test = "1"; $stmt->execute([ $test ]);
  13. Thanks for your help, I had never created my own div before, making them dynamically. I just completed the Administrator's product system. For the rest, I plan to use modern PHP instead of the Vanilla variety. Josh
×
×
  • 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.