Jump to content

roberto68

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by roberto68

  1. function proceed($mapType){ switch($mapType) { case "showevent" : $("#dropdowns").attr("action", showEvent.html); $("#dropdowns").submit(); window.location.replace("showEvent.html"); break; case "addplace" : $("#dropdowns").attr("action", addPlace.html); $("#dropdowns").submit(); window.location.replace("addPlace.html");break; case "addevent" : $("#dropdowns").attr("action",map.html); $("#dropdowns").submit(); window.location.replace("map.html");break; here's javascript and here is html <input type="button" value="add a place" id="addplace" onclick="proceed(addplace)" /> <input type="button" value="add an event" id="addevent" onclick="proceed(addevent)" /> <input type="button" value="show event" id="showevent" onclick="proceed(showevent)" /> what I want is to post dropdowns form ( form consisting of 4 dropdown lists) to diffenrent page - according to button clicked and redirect to that page after that
  2. thanks actually there should be parnenthesis but after add column, unlike I get an error alter table pictures add column (location_id int not null, foreign key(location_id) references locations (id) on delete cascade on update restrict);
  3. I need to create a foregin key in table pictures that references id from table locations - locations.id - I chcek mariaDB manuals https://mariadb.com/kb/en/mariadb/foreign-keys/ but it says I have error in my syntax still here's my code alter table pictures(add column location_id int not null, foreign key(location_id) references locations (id) on delete cascade on update restrict) what am I doing wrong? and one more question : how to create index in MariaDB cause I haven't been successfull in that too, thanks
  4. I need to do a simple task user selects on Dropdown list - whether to take, or upload picture - and then whole from (the picture is the part of this form is send to php script so it can be saved to Database. so i google a bit but I'm still confused a little. so here's what I'm using //the javascript$("takePhoto").change(function() { // cchek - DDlist state change if(this.checked) { addPhotos(); } }function takeAction(){ $("#addPlace").submit(); }function addPhotos() { var takePicture = document.querySelector("#take-picture"), showPicture = document.querySelector("#show-picture"); if (takePicture && showPicture) { // Set events takePicture.onchange = function (event) { // Get a reference to the taken picture or chosen file var files = event.target.files, file; if (files && files.length > 0) { file = files[0]; try { // Get window.URL object var URL = window.URL || window.webkitURL; // Create ObjectURL var imgURL = URL.createObjectURL(file); // Set img src to ObjectURL showPicture.src = imgURL; // Revoke ObjectURL URL.revokeObjectURL(imgURL); } catch (e) { try { // Fallback if createObjectURL is not supported var fileReader = new FileReader(); fileReader.onload = function (event) { showPicture.src = event.target.result; }; fileReader.readAsDataURL(file); } catch (e) { // var error = document.querySelector("#error"); if (error) { error.innerHTML = "Neither createObjectURL or FileReader are supported"; } } } } }; }} //and finally the php.... $photo=$_POST['take-picture']; <form id="addPlace" action="set_coords.php" enctype="multipart/form-data"> <input type="text" name="location" id="location" visibility="hidden" /> Location: <input name="address" type="text" id="address" /><input type="hidden" name="total" id="total"/> Add Playground photos <select id="uploadType" ><option type="file" name="takePhoto" id="take-picture" accept="image/*"/> <option type="file" id="upload" onclick="upload();">Upload a photo</option> <!-- funckia upload - definovatv global js --> </select> <input type="checkbox" id="photo_boolean" /> </form> is that all I need?
×
×
  • Create New...