For an acceptable answer, leave me an email at : and I'll pay you what I can. This is for Javascript and PHP. I have the following code which is passing the variables to: SaveProductItems(... The passed values are being set to: "" or [object HTMLInputElement] 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; } PHP: Here is the Javascript : 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(); } Code (JavaScript): Thank you, for allowing me to finish my admin side ecommerce project. JoshuaEir
The main reason I can't debug this code is cause it's too painful to read. I advice against putting all your html code inside a php string. This is where you might want to use a templating engine. If you don't like adding libs to your project, you can design a mini one for your use. Can you show me the project so I can run it locally?
This has nothing to do with your problem, but should be addressed anyhow. You have multiple H4 tags and NO H2 NOR H3 tags. That is wrong by definition and WILL cause accessibility problems. By definition you CANNOT have H4 tags UNLESS you also have H1, H2, AND H3 tags, in that order before any H4 tags.
Thank you, mmerlinn. I'm wondering how in the world I am going to get this figured out. I am doing the second stage with goLang. Efetobor, maybe you can help me out... https://github.com/Joshei/php-proj/tree/regularquerybackforth
Well, I have changed my string to : $string0 = " <center><p> <input id = \"$titleID\" value = \"$title1\" type=\"text\" name=\"title\" placeholder=\"\">$title1</p></center> <center><button id = \"test2az\" onclick = \"SaveProductItems( '{$productID}', '{$deleteFlag}', '{$mainDiv}', '{$titleID}', '{$descID}', '{$costID}','{$quantityID}', '{$key1ID}' , '{$key2ID}' , '{$key3ID}' )\">Resubmit</button></center> "; PHP: Since it worked fine, I have determined that the rest of the string is the problem. I should be able to solve it now.