Jump to content

hobbiton73

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by hobbiton73

  1. Hi, many thanks for helping me out, again I've used the line of code you suggested, so that the script looks like: <?php $galleryPath = 'UploadedFiles/';$absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR;$descriptions->load($absGalleryPath . 'files.xml'); $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> Unfortunately, when I run this, I receive the following error: Line 6 is this line: $descriptions->load($absGalleryPath . 'files.xml'); I think that problem isn't necessarily the file path, but I'm unsure about what the 'username' and 'location' folders should be called in the file path because they are dynmaic values, if that makes sense? Kind regards
  2. I wonder whether someone may be able to help me please. I've put together the following script which saves user defined images to server folders using the Aurigma Image Uploader software. <?php require_once 'Includes/gallery_helper.php'; require_once 'ImageUploaderPHP/UploadHandler.class.php'; $galleryPath = 'UploadedFiles/'; function onFileUploaded($uploadedFile) { global $galleryPath; $packageFields = $uploadedFile->getPackage()->getPackageFields(); $username=$packageFields["username"]; $locationid=$packageFields["locationid"]; $usernamefolder = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['username']); $locationfolder = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['locationid']); $dirName = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['folder']); $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; if (!is_dir($absGalleryPath)) mkdir($absGalleryPath, 0777, true); chmod($absGalleryPath, 0777); if (!is_dir($absGalleryPath . $dirName)) mkdir($absGalleryPath . $dirName, 0777, true); chmod($absGalleryPath . $dirName, 0777); if ($uploadedFile->getPackage()->getPackageIndex() == 0 && $uploadedFile->getIndex() == 0) initGallery($absGalleryPath, $absThumbnailsPath, FALSE); $originalFileName = $uploadedFile->getSourceName(); $files = $uploadedFile->getConvertedFiles(); $sourceFileName = getSafeFileName($absGalleryPath, $originalFileName); $sourceFile = $files[0]; if ($sourceFile) $sourceFile->moveTo($absGalleryPath . $sourceFileName); $thumbnailFileName = getSafeFileName($absThumbnailsPath, $originalFileName); $thumbnailFile = $files[1]; if ($thumbnailFile) $thumbnailFile->moveTo($absThumbnailsPath . $thumbnailFileName); $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); $xmlFile = $descriptions->createElement('file'); // <-- please check the following line $xmlFile->setAttribute('name', $_POST['folder'] . '/' . $originalFileName); $xmlFile->setAttribute('source', $sourceFileName); $xmlFile->setAttribute('size', $uploadedFile->getSourceSize()); $xmlFile->setAttribute('originalname', $originalFileName); $xmlFile->setAttribute('thumbnail', $thumbnailFileName); $xmlFile->setAttribute('description', $uploadedFile->getDescription()); $xmlFile->setAttribute('username', $username); $xmlFile->setAttribute('locationid', $locationid); $xmlFile->setAttribute('folder', $dirName); $descriptions->documentElement->appendChild($xmlFile); $descriptions->save($absGalleryPath . 'files.xml'); } $uh = new UploadHandler(); $uh->setFileUploadedCallback('onFileUploaded'); $uh->processRequest(); ?> This code saves the files in the following structure: UploadedFiles (Pre-existing folder) 'username' (Subfolder created dynamically on image upload if it doesn't already exist. This folder contains the 'location' folder) 'location' (Subfolder created dynamically on image upload if it doesn't already exist. This contains original image, 'files.xml' and 'Thumbnails' folder) 'Thumbnails' (Subfolder created dynamically on image upload if it doesn't already exist. This contains thumbnail of original image) I'm now trying to put together a script which creates an image gallery, with those images pertinent to the current user and location. The code below is the piece of my script which deals with the loading of the images. <?php $galleryPath = 'UploadedFiles/'; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> The initial problem I had, was resolved from guidance I received on this site, and that was to find the correct 'realpath' of the 'Thumbnails' folder and 'files.xml' These are as follows: and with 'IRHM73' being the 'username' value and '1' the 'location' value. The problem I now have lies within this line of code: `$absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR;` Because the 'username' and 'location' are dynamic and hence contain different values for each user and location, I've found it impossible to find a way of creating the correct file path to open the 'Thumbnails' folder and 'files.xml'. I had tried this: <?php $galleryPath = 'UploadedFiles/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> But I receive the following error: DOMDocument::load() domdocument.load: I/O warning : failed to load external entity /homepages/2/d333603417/htdocs/development/UploadedFiles/'files.xml'; in /homepages/2/d333603417/htdocs/development/gallery.php on line 13 and line 13 is this: $descriptions->load($absGalleryPath . 'files.xml'); I really am stumped with what to do next to get this to work. I appreciate that this is a fairly lengthy post, but thought it would be better to post all the information. I just wondered whether someone could perhaps take a look at this and let me know where I'm going wrong and how I can get it to work. Many thanks and regards
  3. Hi, many thanks for your continued help with this. I'm starting to work through the examples you kindly provided, and after some head scratching I've started to get the desired results. Many thanks for all your time and trouble. Kind regards
  4. Hi, many thanks for this. Using the link that you provided I've read through this read additional material on 'realpath' but I must ahve misunderstood something along the way. I''ve put together the followimg: <?php chdir('/var/www/'); echo realpath('./././files.xml); ?> and called it 'real.php', but when I run this, I don't receive the file path, nor any any error. The screen is just blank. My file structure is UploadedFiles Folder containing 'real.php' file and 'username' folder 'username' folder (Subfolder containing 'location' folder) 'location' folder (Subfolder containing 'files.xml') I'm sure I'm just making a beginners mistake here, but I just wondered if you could perhaps look at this please and let me know where I'm going wring? Many thanks and kind regards
  5. Hi, yes that's what I thought the issue would be, and that's really the problem I have, now my file and folder structure have changed I'm not sure how to send it to the correct filepath. Regards
  6. and this is how it's shown when I go into view source: Kind regards Chris
  7. Hi many thanks for replying to my post, and apologies for not providing all you needed. The full error momentarily flashes on the screen but I've managed to capture it here: Kind regards Chris
  8. I wonder whether someone may be able to help me please. I'm trying to put together a PHP within Aurigma Image Uploader which will create an image gallery. To do this I need to extract the image from a folder called 'Thumbnails' and image data from a file called 'files.xml'. The code below is an extract of the default script that performs this functionality and I've tested and it works without any issues. <?php //This variable specifies relative path to the folder, where the gallery with uploaded files is located. //Do not forget about the slash in the end of the folder name. $galleryPath = 'UploadedFiles/'; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> I have now changed my folder and file structure to the following: UploadedFiles (Folder) username (Subfolder containing the 'location' folder) location (Subfolder containing 'Thumbnails folder and image, and 'files.xml') Please note that both the 'username' and 'location' folders are dynamically created when the user initially uploads the images. To try and accomodate the new file structure I changed my code to: <?php //This variable specifies relative path to the folder, where the gallery with uploaded files is located. //Do not forget about the slash in the end of the folder name. $galleryPath = 'UploadedFiles/'; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $usernamefolder . DIRECTORY_SEPARATOR . $locationfolder . DIRECTORY_SEPARATOR; $thumbnailsPath = $galleryPath . 'Thumbnails/'; $descriptions = new DOMDocument('1.0'); $descriptions->load($absGalleryPath . 'files.xml'); ?> But when I run this I receive the following error: Line 14 is this line: $descriptions->load($absGalleryPath . 'files.xml'); I've been working on this for days and I just can't seem to find the answer. I just wondered whether someone could possibly look at this and let me know where I'm going wrong. If it helps, I've added the upload script below. <?php require_once 'Includes/gallery_helper.php'; require_once 'ImageUploaderPHP/UploadHandler.class.php'; $galleryPath = 'UploadedFiles/'; function onFileUploaded($uploadedFile) { global $galleryPath; $packageFields = $uploadedFile->getPackage()->getPackageFields(); $username=$packageFields["username"]; $locationid=$packageFields["locationid"]; $username = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['username']); $location = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['locationid']); $dirName = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $_POST['folder']); $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR . $username . DIRECTORY_SEPARATOR . $location . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; if (!is_dir($absGalleryPath)) mkdir($absGalleryPath, 0777, true); chmod($absGalleryPath, 0777); if (!is_dir($absGalleryPath . $dirName)) mkdir($absGalleryPath . $dirName, 0777, true); chmod($absGalleryPath . $dirName, 0777); if ($uploadedFile->getPackage()->getPackageIndex() == 0 && $uploadedFile->getIndex() == 0) initGallery($absGalleryPath, $absThumbnailsPath, FALSE); $originalFileName = $uploadedFile->getSourceName(); $files = $uploadedFile->getConvertedFiles(); $sourceFileName = getSafeFileName($absGalleryPath, $originalFileName); $sourceFile = $files[0]; if ($sourceFile) $sourceFile->moveTo($absGalleryPath . $sourceFileName); $thumbnailFileName = getSafeFileName($absThumbnailsPath, $originalFileName); $thumbnailFile = $files[1]; if ($thumbnailFile) $thumbnailFile->moveTo($absThumbnailsPath . $thumbnailFileName); $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); $xmlFile = $descriptions->createElement('file'); // <-- please check the following line $xmlFile->setAttribute('name', $_POST['folder'] . '/' . $originalFileName); $xmlFile->setAttribute('source', $sourceFileName); $xmlFile->setAttribute('size', $uploadedFile->getSourceSize()); $xmlFile->setAttribute('originalname', $originalFileName); $xmlFile->setAttribute('thumbnail', $thumbnailFileName); $xmlFile->setAttribute('description', $uploadedFile->getDescription()); $xmlFile->setAttribute('username', $username); $xmlFile->setAttribute('locationid', $locationid); $xmlFile->setAttribute('folder', $dirName); $descriptions->documentElement->appendChild($xmlFile); $descriptions->save($absGalleryPath . 'files.xml'); } $uh = new UploadHandler(); $uh->setFileUploadedCallback('onFileUploaded'); $uh->processRequest(); ?> Many thanks
  9. I wonder whether someone may be able to help me please. I've been working on this for a couple of weeks now, and I just can't find the solution. I'm using the Image Uploader software from Aurgima, and http://www.mapmyfinds.co.uk/development/index.php this is what I've managed to put together so far. The problem I have is that the files are saved within a generic folder structure to be more precise: 'UploadedFiles' (Main folder) contaning: 'files.xml' saved original image 'Thumbnails' (sub folder containing the saved thumbnail image) What I'd like to be able to is to make the folder structure more user specific and, providing that the folder doesn't already exist I'd like to create another folder level i.e. 'UploadedFiles' (Main folder) contaning 'Username' (subfolder containing: 'files.xml', saved original image and 'Thumbnails subfolder) Please find below the script which I've put together for the 'User Input' and 'Image Upload' 'User Input - 'index.php' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <?php $userfolder = '"$username"'; $galleryPath = 'UploadedFiles/'; $absGalleryPath = realpath($galleryPath) . '/'; $dirs = array(); if (file_exists($absGalleryPath . 'files.xml')) { $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) { $name = $descriptions->documentElement->childNodes->item($i)->getAttribute('name'); $dir = dirname($name); if ($dir && $dir != '.') { $dirs[] = array_shift(explode('/', $dir)); } } $dirs = array_unique($dirs); } ?> <head> <title>Add New Images</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="Styles/style.css" rel="stylesheet" type="text/css" /> <!--[if IE]> <link href="../../Styles/ie.css" rel="stylesheet" type="text/css" /> <![endif]--> <script type="text/javascript" src="Libraries/jquery/jquery-1.4.3.min.js"></script> <script type="text/javascript"> $(function() { var uploaderID = 'Uploader1'; function updateInfo() { var restrictions = $au.uploader(uploaderID).restrictions(); var params = { enableCmyk: restrictions.enableCmyk() && restrictions.EnableCmyk() !== "false" ? 'True' : 'True', fileMask: restrictions.fileMask() || '*.*', maxFileCount: parseInt(restrictions.maxFileCount()) || 'any', maxFileSize: parseInt(restrictions.maxFileSize()) || 'any', maxImageHeight: parseInt(restrictions.maxImageHeight()) || 'any', maxImageWidth: parseInt(restrictions.maxImageWidth()) || 'any' }; var infoHtml = '<li>Allowed File Types: ${fileMask}</li>' + '<li>Maximum number of files per upload: ${maxFileCount}</li>' + '<li>Maximum file size: 1024KB </li>'; infoHtml = infoHtml.replace(/\$\{(\w+)\}/g, function(str0, str1, offset, s) { return params[str1]; }); $('#info').html(infoHtml); } updateInfo(); }); </script> <script type="text/javascript"> $(function () { $('input[name=folder-type]').click(function (ev) { $('.folder-name').attr('disabled', 'disabled').parent().addClass('disabled'); $(this).parents('.row').removeClass('disabled').children('.folder-name').attr('disabled', ''); }); $('#folder-type-new').change(function() { $('#folderNameTextBox').select().focus(); }); $('#folder-type-existing').change(function() { $('#folderNameDropDownList').focus(); }); if ($('#folderNameDropDownList')[0].options.length == 0) { $('#folder-type-existing').attr('disabled', true); } $('#folderNameTextBox').focus(); }); function onBeforeUpload() { // Get folder name var folderName = $('input[name=folder-type]:checked').parents('.row').children('.folder-name').val(); if (!folderName) { alert('Specify folder name'); return false; } // Add folder name field this.metadata().addCustomField('folder', folderName); count = this.files().count(); // get count of files added to upload list for (i = 0; i < count; i ++){ // iterate them if (this.files().get(i).description() == "") // check whether “description” is empty this.files().get(i).description("No description provided"); // if so, add “No description provided” text to “description” field } } </script> <style type="text/css"> <!-- .style1 { font-size: 14px; margin-top: 5px; margin-right: 110px; } --> </style> </head> <body style="font-family: Calibri; color: #505050; margin-left: 240px;"> <div align="right" class="style1"> Add Images → <a href = "imagefolders.php" /> View Uploaded Images In Folder Structure </a> </div> <form id="addnewimages" name="addnewimages" class="page" action="index.php" method="post" enctype="application/x-www-form-urlencoded"> <div class="aB"> <div class="aB-B"> <div class="demo"> <div class="inner"> <div class="container"> <fieldset class="content-block"> <legend>Restriction settings <legend>username</legend><input name="username" id="username" type="text" value="IRHM73" /> <legend>locationid</legend><input name="locationid" id="locationid" type="text" value="1" /> </legend> <div class="row"> <ul id='info'> </ul> </div> </fieldset> <fieldset class="folder-settings content-block"> <legend>Folder name</legend> <div class="row"> <label for="folder-type-new" class="caption"> <input type="radio" name="folder-type" id="folder-type-new" checked="checked" /> New folder </label> <input type="text" id="folderNameTextBox" value="" class="folder-name"/> </div> <div class="row disabled"> <label for="folder-type-existing" class="caption"> <input type="radio" name="folder-type" id="folder-type-existing" /> Existing folder </label> <select id="folderNameDropDownList" class="folder-name" disabled="disabled"> <?php foreach ($dirs as $dir) : ?> <option><?php echo htmlentities($dir, NULL, 'UTF-8'); ?></option> <?php endforeach; ?> </select> </div> </fieldset> <div class="code"> <?php require_once "ImageUploaderPHP/Uploader.class.php"; // create Uploader object and specify its ID and size $uploader = new Uploader("Uploader1"); $uploader->setWidth("790px"); $uploader->setHeight("270px"); // specify a license key $uploader->setLicenseKey("XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"); $uploader->setScriptsDirectory ('ImageUploaderPHP/Scripts'); $uploader->getJavaControl()->setCodeBase ('ImageUploaderPHP/Scripts/ImageUploader7.jar'); $uploader->getActiveXControl()->setCodeBase ('ImageUploaderPHP/Scripts/ImageUploader7.cab'); // configure upload settings $uploader->getUploadSettings()->setActionUrl("upload.php"); $uploader->getUploadSettings()->setRedirectUrl("index.php"); $uploader->getMetadata()->setAdditionalFormName("addnewimages"); $uploader->getUploadSettings()->setFilesPerPackage(1); // setting folder pane height $uploader->getFolderPane()->setHeight("260"); // setting view mode of Folder & Upload pane $uploader->getFolderPane()->setViewMode('Tiles'); $uploader->getUploadPane()->setViewMode('Tiles'); // setting of file restrictions $uploader->getRestrictions()->setFileMask('*.jpg;*.jpeg;*.png;*.bmp;*.gif'); $uploader->getRestrictions()->setEnableCmyk(true); $uploader->getRestrictions()->setMaxFileCount(10); $uploader->getMessages()->setMaxFileCountExceeded("I'm sorry, the number of files you have selected for this upload session exceed the 10 file limit."); $uploader->getRestrictions()->setMaxTotalFileSize(10485760); $uploader->getMessages()->setMaxTotalFileSizeExceeded("I'm sorry, the number of files that you have selected for this upload session exceed the 10MB limit."); $uploader->getRestrictions()->setMaxFileSize(1048576); $uploader->getRestrictions()->setDeniedFileMask("*.exe;*.bat;*.cmd;*.wsf"); /* Configure converters */ //Main converter $converter1 = new Converter(); $converter1->setMode('*.*=Thumbnail'); $converter1->setThumbnailWidth(700); $converter1->setThumbnailHeight(700); $converter1->setThumbnailFitMode("Fit"); $converter1->setThumbnailApplyCrop(true); //Converter for gallery $converter2 = new Converter(); $converter2->setMode('*.*=Thumbnail'); $converter2->setThumbnailWidth(180); $converter2->setThumbnailHeight(180); $converter2->setThumbnailFitMode("Fit"); $converter2->setThumbnailApplyCrop(true); $uploader->setConverters(array( $converter1, $converter2 )); $uploader->setConverters(array( $converter1, $converter2 )); // setting informationa and colour of files upon selection or hover over $uploader->getPaneItem()->setShowFileNameInThumbnailsView(TRUE); $uploader->getDetailsViewColumns()->setInfoText(''); $uploader->getDetailsViewColumns()->setDimensionsText(''); $uploader->getClientEvents()->setBeforeUpload('onBeforeUpload'); require_once 'ImageUploaderPHP/InstallationProgress.class.php'; $ip = new InstallationProgress($uploader); $ip->setProgressImageUrl('Images/installation_progress.gif'); $ip->setProgressCssClass('ip-progress'); $ip->setInstructionsCssClass('ip-instructions'); $uploader->render(); ?> </div> </div> </div> </div> </div> </div> </form> </body> </html> Image Upload - 'upload.php' <?php //This variable specifies relative path to the folder, where the gallery with uploaded files is located. //Do not forget about the slash in the end of the folder name. $galleryPath = 'UploadedFiles/'; require_once 'Includes/gallery_helper.php'; require_once 'ImageUploaderPHP/UploadHandler.class.php'; /** * FileUploaded callback function * @param $uploadedFile UploadedFile */ function onFileUploaded($uploadedFile) { $packageFields = $uploadedFile->getPackage()->getPackageFields(); $username = $packageFields["username"]; $locationid= $packageFields["locationid"]; global $galleryPath; $absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR; $absThumbnailsPath = $absGalleryPath . 'Thumbnails' . DIRECTORY_SEPARATOR; if ($uploadedFile->getPackage()->getPackageIndex() == 0 && $uploadedFile->getIndex() == 0) { initGallery($absGalleryPath, $absThumbnailsPath, FALSE); } $userfolder = $_POST'$userfolder']; $dirName = $_POST['folder']; $dirName = preg_replace('/[^a-z0-9_\-\.()\[\]{}]/i', '_', $dirName); if (!is_dir($absGalleryPath . $dirName)) { mkdir($absGalleryPath . $dirName, 0777); } $path = rtrim($dirName, '/\\') . '/'; $originalFileName = $uploadedFile->getSourceName(); $files = $uploadedFile->getConvertedFiles(); // save converter 1 $sourceFileName = getSafeFileName($absGalleryPath, $originalFileName); $sourceFile = $files[0]; /* @var $sourceFile ConvertedFile */ if ($sourceFile) { $sourceFile->moveTo($absGalleryPath . $sourceFileName); } // save converter 2 $thumbnailFileName = getSafeFileName($absThumbnailsPath, $originalFileName); $thumbnailFile = $files[1]; /* @var $thumbnailFile ConvertedFile */ if ($thumbnailFile) { $thumbnailFile->moveTo($absThumbnailsPath . $thumbnailFileName); } //Load XML file which will keep information about files (image dimensions, description, etc). //XML is used solely for brevity. In real-life application most likely you will use database instead. $descriptions = new DOMDocument('1.0', 'utf-8'); $descriptions->load($absGalleryPath . 'files.xml'); //Save file info. $xmlFile = $descriptions->createElement('file'); $xmlFile->setAttribute('name', $_POST['folder'] . '/' . $originalFileName); $xmlFile->setAttribute('source', $sourceFileName); $xmlFile->setAttribute('size', $uploadedFile->getSourceSize()); $xmlFile->setAttribute('originalname', $originalFileName); $xmlFile->setAttribute('thumbnail', $thumbnailFileName); $xmlFile->setAttribute('description', $uploadedFile->getDescription()); //Add additional fields $xmlFile->setAttribute('username', $userid); $xmlFile->setAttribute('locationid', $locationid); $xmlFile->setAttribute('folder', $dirName); $descriptions->documentElement->appendChild($xmlFile); $descriptions->save($absGalleryPath . 'files.xml'); } $uh = new UploadHandler(); $uh->setFileUploadedCallback('onFileUploaded'); $uh->processRequest(); ?> I'm not particularly well versed in php, but I've tried to add a variable 'userfolder' to try and capture the username to create the folder, but without any success. I apologise for the lengthy post, but I just wondered whether someone could perhaps take a look at this please and let me know where I'm going wrong.
  10. All, Many thanks for your help. I wasn't able to get this particular example working. However, a few days ago I'd saved details of a simpler script. At the time I couldn't get it to work, but through all of your help I've now been able to get this working. Kind regards
  11. Hi, many thanks for the clarification. Unfortunately though, again after making the changes I'm still confronted by the same error. Perhaps this a beginners view on things but is this line correct? echo "<center><table border='0' width='100%' cellspacing='0' cellpadding='0' > <tr bgcolor='#ffffcc'><form name=myForm method='post' onSubmit="ajaxFunction(this.form); return false"> I was thinking that the form should come before the PHP. Kind regards
  12. Hi, many thanks for this, I really appreciate any help that I can get. Unfortunately after making the changes I'm still getting the same error. I've added my code below. I just wondered if you could perhaps have a look at this please to see if there is anything else that I'm doing wrong. Kind regards ajaxfunction.php <html> <head> <script type="text/javascript"> function ajaxFunction() { //document.writeln(val) var httpxml; try { // Firefox, Opera 8.0+, Safari httpxml=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { httpxml=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpxml=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } function stateChanged(){ if(httpxml.readyState==4){ var myObject = eval('(' + httpxml.responseText + ')'); //var myObject = httpxml.responseText; //document.getElementById("display").innerHTML=myObject; var msg=myObject.value[0].message; if(msg.length > 0){document.getElementById("msg").innerHTML=msg;} else{document.getElementById("msg").style.display='none';} var str="<table width='50%' bgcolor='#ffffff' align=center><tr><th>ID</th><th>Name</th></tr>"; var color="#f1f1f1"; for(i=0;i<myObject.data.length;i++) { if((i%2)==0){color="#ffffff";} else{color="#f1f1f1";} str = str + "<tr bgcolor="+color+"><td>" + myObject.data[i].subcat_id + " </td><td>"+ myObject.data[i].subcat_name + "</a></td></tr>" } str = str + "</table>" ; document.getElementById("display").innerHTML=str; } } var url="subcat2.php"; var cat_id=document.myForm.cat_id.value; url=url+"?cat_id="+cat_id; url=url+"&kid="+Math.random(); //alert(url) httpxml.onreadystatechange=stateChanged; httpxml.open("GET",url,true); httpxml.send(null); // document.getElementById("display").innerHTML="Please Wait...."; document.getElementById("msg").style.background='#f1f1f1'; document.getElementById("msg").innerHTML="Please Wait ... "; document.getElementById("msg").style.display='inline'; } </script> <?php require "z_db.php"; echo '</head><body onload="ajaxFunction()";>'; echo "<center><table border='0' width='100%' cellspacing='0' cellpadding='0' > <tr bgcolor='#ffffcc'><form name=myForm method='post' onSubmit="ajaxFunction(this.form); return false"> <td align='center' colspan=2><font face='verdana, arial, helvetica' size='2' ><b> Select a Category</b> </font></td></tr>"; echo "<tr>"; echo "<td align='center'>"; $query="SELECT * FROM plus2_cat order by cat_name"; $result=mysql_query($query); echo mysql_error(); echo "<select name=cat_id onChange="ajaxFunction()"><option value=0>Show All</option>"; while($nt=mysql_fetch_array($result)){ echo "<option value=$nt[cat_id]>$nt[cat_name]</option>"; } echo "</select>"; echo "</font></td>"; echo "</tr></form>"; echo "</table>"; ?> <div id=msg style="position:absolute; z-index:1; left: 1100px; top: 0px;" >This is message area</div> <div id="display"><b>Records will be displayed here</b></div> </body> </html>
  13. Hi, I'm very sorry to ask, but could perhaps elaborate a little. I'm a fairly new to this and I'm not quite sure what you mean. Many thanks and kind regards
  14. I wonder whether someone can help me please. I've found http://www.plus2net.com/php_tutorial/ajax-listbox.php tutorial to create a drop down menu using mySQL table data, which, in turn returns a list of results on the page. Following this tutorial I've put together the tables in my database and the required scripts as shown in the tutorial with the one exception, the "z_db.php" file, which I've assumed to be: <?php mysql_connect("host", "user", "password")or die(mysql_error()); mysql_select_db("database"); ?> The problem I have, is that when I try and run this, I receive the following error: I must admit I've guessed as to the structure of the 'z_db.php' file should look like because this is not shown so perhaps this is the problem. I just wondered wether someone could perhaps take a look at this please and let me know where I've gone wrong. Many thanks and kind regards
  15. Hi, that's great. Thank you very much for your help. Kind regards Chris
  16. Hi, I wonder whether someone may be able to help me please. I'm fairly new to PHP so please bear with me. I'm trying to put together a script which bascially creates a hierarchical tree of folders upon a new account being created by a user. I would like to take the 'username' that the user registers with to use as the name for the first folder, then, create a folder at the second level called 'images' and then finally, a folder within that called 'thumbs'. From the research that I've done, I believe that I need to use the 'mkdir' command, but I can't find a very straight forward tutorial. I just wondered whether someone could perhaps please help me out with this, so that I at least have a good solid starting point.
  17. Hi many thanks for taking the time to reply to my post, but I must admit to being a little lost! I'm am relatively new to PHP, so could you possibly elaborate as to the changes that I need to make to my script so I can then tie them up with the links you kindly provided. Kind regards Chris
  18. Hi, I wonder whether someone may be able to help me please. Through articles I've read on the Interent I've put together the code shown below which allows a user to upload, view and delete image files from a mySQL database. if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); // This function makes usage of // $_GET, $_POST, etc... variables // completly safe in SQL queries function sql_safe($s) { if (get_magic_quotes_gpc()) $s = stripslashes($s); return mysql_real_escape_string($s); } // If user pressed submit in one of the forms if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!isset($_POST["action"])) { // cleaning title field $title = trim(sql_safe($_POST['title'])); if ($title == '') // if title is not set $title = '(No title provided';// use (empty title) string if (isset($_FILES['photo'])) { @list(, , $imtype, ) = getimagesize($_FILES['photo']['tmp_name']); // Get image type. // We use @ to omit errors if ($imtype == 3) // cheking image type $ext="png"; // to use it later in HTTP headers elseif ($imtype == 2) $ext="jpeg"; elseif ($imtype == 1) $ext="gif"; else $msg = 'Error: unknown file format'; if (!isset($msg)) // If there was no error { $data = file_get_contents($_FILES['photo']['tmp_name']); $data = mysql_real_escape_string($data); // Preparing data to be used in MySQL query mysql_query("INSERT INTO {$table} SET ext='$ext', title='$title', data='$data'"); $msg = 'Success: Image Uploaded'; } } elseif (isset($_GET['title'])) // isset(..title) needed $msg = 'Error: file not loaded';// to make sure we've using // upload form, not form // for deletion elseif($_FILES["fileupload"]["size"]/1024000 >= 10) // 10mb { $msg = "<br />Your uploaded file size:<strong>[ ". $_FILES["fileupload"]["size"]/1024000 . " MB]</strong> is more than allowed 10MB Size.<br />"; } if (isset($_POST['del'])) // If used selected some photo to delete { // in 'uploaded images form'; $imageid = intval($_POST['del']); mysql_query("DELETE FROM {$table} WHERE imageid=$imageid"); $msg = 'Photo deleted'; } if (isset($_POST['view'])) // If used selected some photo to delete { // in 'uploaded images form'; $imageid = intval($_POST['view']); mysql_query("SELECT ext, data FROM {$table} WHERE imageid=$imageid"); if(mysql_num_rows($result) == 1) { $image = $row['myimage']; header("Content-type: image/gif"); // or whatever print $image; exit; } } } else { $imageid = intval($_POST['del']); if ($_POST["action"] == "view") { $result = mysql_query("SELECT ext, UNIX_TIMESTAMP(imagetime), data FROM {$table} WHERE imageid=$imageid LIMIT 1"); if (mysql_num_rows($result) == 0) die('no image'); list($ext, $imagetime, $data) = mysql_fetch_row($result); $send_304 = false; if (php_sapi_name() == 'apache') { // if our web server is apache // we get check HTTP // If-Modified-Since header // and do not send image // if there is a cached version $ar = apache_request_headers(); if (isset($ar['If-Modified-Since']) && // If-Modified-Since should exists ($ar['If-Modified-Since'] != '') && // not empty (strtotime($ar['If-Modified-Since']) >= $imagetime)) // and grater than $send_304 = true; // imagetime } if ($send_304) { // Sending 304 response to browser // "Browser, your cached version of image is OK // we're not sending anything new to you" header('Last-Modified: '.gmdate('D, d M Y', $ts).' GMT', true, 304); exit(); // bye-bye } // outputing HTTP headers header('Content-Length: '.strlen($data)); header("Content-type: image/{$ext}"); // outputing image echo $data; exit(); } else if ($_POST["action"] == "delete") { $imageid = intval($_POST['del']); mysql_query("DELETE FROM {$table} WHERE imageid=$imageid"); $msg = 'Photo deleted'; } } } ?> The problem I'm having is around the error message shown if the File Size is over the prescribed limit. The part of the script that deals with this starts with the line: elseif($_FILES["fileupload"]["size"]/1024000 >= 10) // 10mb Even though the file upload may fail because of the size of the file I receive the 'Error: unknown file format' message, and I'm not sure why. I'm certainly no expert when it comes to PHP, so perhaps my lack of knowledge is letting me down. But I just wondered if someone could perhaps take a look at this please and let me know where I'm going wrong. Many thanks Chris
  19. I wonder whether someone may be able to help me please. I'm currently running the code below (originating from nearby.org.uk) to convert OS Grid References to Latitude and Longtiude co-ordinates. function converttolatlng() { var gr = document.getElementById('osgridref').value; var osgb = new GT_OSGB(); if (osgb.parseGridRef(gr)) { var wgs84 = osgb.getWGS84(); document.getElementById('osgb36lat').value = wgs84.latitude; document.getElementById('osgb36lon').value = wgs84.longitude; } else { document.getElementById('osgb36lat').value = "n/a"; document.getElementById('osgb36lon').value = "n/a"; } } This code is run through a 'click' event from a button on a HTML form and then the record is saved to a mySQL database. However, once a month, I have a list of approx 20,000 OS Grid References which need converting and saving to the same mySQL database. To do this manually on a button click wouldn't be very practical, so I've been working on doing this automatically. I may very well be doing this the wrong way, but I've been using the PHP script below to extract the two pieces of information I need from the xml file, the first is the 'Name, and the second is the 'NGR', and it is this field that needs converting. <? $objDOM = new DOMDocument(); $objDOM->load("scheduledmonuments.xml"); $Details = $objDOM->getElementsByTagName("Details"); foreach( $Details as $value ) { $Name = $value->getElementsByTagName("Name"); $name = $Name->item(0)->nodeValue; $NGR = $value->getElementsByTagName("NGR"); $ngr = $NGR->item(0)->nodeValue; echo "$name :: $ngr <br>"; } ?> This is where I've become a little stuck because I'm not sure how to get the data converted and to a point where it can be saved to the relevant fields in my database. I just wondered whether someone would perhaps take a look at this please and let me know what I need to do. Many thanks
  20. Hi, many thanks for replying to my post. I'm quite happy to use one page, so I've amalgamted the two and posted the revised code below. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <?php require("phpfile.php"); // Opens a connection to a MySQL server $connection=mysql_connect ("hostname", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error());} // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } $email = $_POST['email']; $result = mysql_query("SELECT forename, surname FROM userdetails WHERE emailaddress like '%$email%'"); while($row = mysql_fetch_array($result)) { echo $row['forename']; echo $row['surname']; echo "<br />"; } ?> <title>Maptitle> <script src="js/gen_validatorv4.js" type="text/javascript"></script> </head> <form name="userpasswordreset" id="userpasswordreset" method="post"> <h2>User Details </h2> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="26%" height="25"><strong>Email Address</strong></td> <td width="4%"> </td> <td width="70%"><input name="email" type="email" id="email" size="50" /></td> </tr> <tr> <td height="25"><strong>Confirm Email</strong></td> <td> </td> <td><input name="conf_email" type="email" id="conf_email" size="50" /></td> </tr> <tr> <td height="25"><label> <input type="submit" name="Submit" value="Search" /> </label></td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong> First Name </strong></td> <td> </td> <td><input name="fname" type="text" id="fname" size="30" value="<?php echo $row['forename']; ?>" /></td> </tr> <tr> <td height="25"><strong> Address Last Name </strong></td> <td> </td> <td><input name="lname" type="text" id="lname" size="30" value="<?php echo $row['surname']; ?>" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password</strong></td> <td> </td> <td><input name="pass" type="password" id="pass" size="30" /></td> </tr> <tr> <td height="25"><strong>Confirm Password </strong></td> <td> </td> <td><input name="conf_pass" type="password" id="conf_pass" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password Hint </strong></td> <td> </td> <td><input name="hint" type="text" id="hint" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("userpasswordreset"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please enter a valid email address"); frmvalidator.addValidation("conf_email","eqelmnt=email", "The confirmed email address is not the same as the email address"); </body> </html> In terms of my setup, I'm not quite sure what you mean, so I hope I've not giving you a load of useless information. My server uses PHP5, my operating system is Windows XP and I'm using Dreamweaver to put my code together. I hope this helps, sincere apologies if it isn't of help. Kind regards
  21. Hi, many thanks for helping me out with this, as I said I'm a novice at this. Could you perhaps tell me please, is it better to move the values from page to page or to incorporate the PHP code within the HTMl form? Regards
  22. I wonder whether someone may be able to help me please. I'm trying to put together php code and an html form that allows an administrator to search for a user via the email address, retrieving the 'first' and 'surname' from the pertinent record in a mySQL database. What I would like to happen is for the retrieved 'first' and surname' values to be automatically populated into the 'first' and 'surname' text boxes on the same search form. I can perform the search and retrieval of the correct record without any problem, but I can't work out how to populate the 'first' and 'surname' values into my search form. I am quote a novice with PHP so apologies if this is a really daft question, but I just windered whether somone could take a look at my code below and let me know where I've gone wrong? Many thanks PHP CODE <?php require("phpfile.php"); // Opens a connection to a MySQL server $connection=mysql_connect ("hostname", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error());} // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } $email = $_POST['email']; $result = mysql_query("SELECT * FROM userdetails WHERE emailaddress like '%$email%'"); while($row = mysql_fetch_array($result)) { echo $row['forename']; echo $row['surname']; echo "<br />"; } ?> HTML FORM !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Maptitle> <script src="js/gen_validatorv4.js" type="text/javascript"></script> </head> <h1><span class="blue">Sign Up</span> For Map My Finds</h1> <form name="userpasswordreset" id="userpasswordreset" method="post" action="search.php"> <h2>Your Details </h2> </div> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="26%" height="25"><strong>Email Address</strong></td> <td width="4%"> </td> <td width="70%"><input name="email" type="email" id="email" size="50" /></td> </tr> <tr> <td height="25"><strong>Confirm Email</strong></td> <td> </td> <td><input name="conf_email" type="email" id="conf_email" size="50" /></td> </tr> <tr> <td height="25"><label> <input type="submit" name="Submit" value="Search" /> </label></td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong> First Name </strong></td> <td> </td> <td><input name="fname" type="text" id="fname" size="30" value="<?php echo $forename; ?>" /></td> </tr> <tr> <td height="25"><strong> Address Last Name </strong></td> <td> </td> <td><input name="lname" type="text" id="lname" size="30" value="<?php echo $surname; ?>" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password</strong></td> <td> </td> <td><input name="pass" type="password" id="pass" size="30" /></td> </tr> <tr> <td height="25"><strong>Confirm Password </strong></td> <td> </td> <td><input name="conf_pass" type="password" id="conf_pass" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"><strong>Password Hint </strong></td> <td> </td> <td><input name="hint" type="text" id="hint" size="30" /></td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> <tr> <td height="25"> </td> <td> </td> <td> </td> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> // Code for validating the form // Visit http://www.javascript-coder.com/html-form/javascript-form-validation.phtml // for details var frmvalidator = new Validator("userpasswordreset"); frmvalidator.addValidation("email","req","Please provide your email address"); frmvalidator.addValidation("email","email","Please enter a valid email address"); frmvalidator.addValidation("conf_email","eqelmnt=email", "The confirmed email address is not the same as the email address"); </body> </html>
  23. Both, sincere thanks for replying to my post. 'monkeytooth' many thanks for your suggestion. If I understood it correctly, I believe I would need to set up an 'elsesif' line for each detector added by users? I was hoping to try an automate this as much as possible because the number of detectors and searchheads will continue to grow, and I wouldn't want to have to manually add this line each time, forgive me if I've got this wrong. 'requinix' again, many thanks for your suggestion. As I said at the beginning I am fairly new to this, so forgive me for asking the dumb questions. I understand the '$newnode' part of the codng but I'm a little lost on the first and last sections. Could you perhaps explain what the 't.', 'd.' and text bits of the code are in the first section and I'm also sorry but I'm not quite clear what I would need to do with the last section. Could you perhaps explain this a little further please? Kind regards Chris
  24. I wonder whether someone may be able to help me please. I'm fairly new to PHP programming so please bear with me. I currently have a HTML user input form, where two of the fields are dependable drop down boxes. The user selects text values from these and, along with other pieces of information, the record is saved to a mySQL database. However, rather than saving the text value I save the 'id' field value for each selection made. On another 'Read Only' form, the user can then go back to have a look at the records they have previously saved. The problem I have is that rather than the user being able to see the text values selected from the drop down menus, they can only see the id for each of the selections made. I just wondered whether it would be at all possible please that someone could show me what I need to do so that the user can see the 'text' rather than the 'id' value from the selections they have made. The code that I am using to load the information into the read only form is below. <?php require("phpfile.php"); // Start XML file, create parent node $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); $parnode = $dom->appendChild($node); // Opens a connection to a MySQL server $connection=mysql_connect ("hostname", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error());} // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the table $query = "SELECT findid, locationid, detectorid, searchheadid "; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("findid",$row['findid']); $newnode->setAttribute("locationid",$row['locationid']); $$newnode->setAttribute("detectorid",$row['detectorid']); $newnode->setAttribute("searchheadid",$row['searchheadid']); } echo $dom->saveXML(); ?> The two fields concerned are 'detectorid' and 'searchheadid'. The tables holding the 'id' and 'text' values for each are in the following tables 'detectors' and searchheads'. Many thanks and kind regards Chris
  25. Hi, i wonder whether someone may be able to help me please. I am using a combination of PHP and AJAX to create two drop down menus on a HTML form. The data is being pulled from a mySQL database with the options available in the second drop down dependent on the value selected in the first. The initial drop down menu called 'detectors' and the behaviours for the second drop down menu, 'searchheads' are created with the following AJAX code: Function AjaxFunction(detectorid) { var httpxml; try { // Firefox, Opera 8.0+, Safari httpxml=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { httpxml=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { httpxml=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } function stateck() { if(httpxml.readyState==4) { var myarray=eval(httpxml.responseText); // Before adding new we must remove previously loaded elements for(j=document.addfindstolocation.searchheads.options.length-1;j>=0;j--) { document.addfindstolocation.searchheads.remove(j); } for (i=0;i<myarray.length;i++) { var optn = document.createElement("OPTION"); optn.text = myarray[i]; optn.value = myarray[i]; document.addfindstolocation.searchheads.options.add(optn); } } } var url="searchheaddetails.php"; url=url+"?detectorid="+detectorid; url=url+"&sid="+Math.random(); httpxml.onreadystatechange=stateck; httpxml.open("GET",url,true); httpxml.send(null); } The following code is the file 'searchheaddetails.php' (as highlighted above) which populates the second drop down menu. <? $detectorid=$_GET['detectorid']; require "config.php"; $q=mysql_query("SELECT * FROM searchheads WHERE detectorid='$detectorid' ORDER BY 'searchheadname' ASC"); echo mysql_error(); $myarray=array(); $str=""; while($nt=mysql_fetch_array($q)){ $str=$str . "\"$nt[searchheadname]\","; } $str=substr($str,0,(strLen($str)-1)); // Removing the last char , from the string echo "new Array($str)"; ?> And this is the section of my form that pulls together the two drop down menus. <form name="addfindstolocation" method="post" id="addfindstolocation"> <div align="left"> <select name=detectors id="detectorid" onchange="AjaxFunction(this.value);"> <option value=''>Select One</option> <? require "phpfile.php";// connection to database $q=mysql_query("SELECT * from detectors WHERE userid='1'ORDER BY 'detectorname' ASC"); while($n=mysql_fetch_array($q)){ echo "<option value=$n[detectorid]>$n[detectorname]</option>"; } ?> </select> </div> </div> <p align="left"> <label></label> <label>Search Head Used</label></p> <div> <div align="left"> <select name=searchheads id="searchheadid"> </select> </div> The drop down menus work fine, but I'm having a little difficulty with the data that is being saved. For the 'detectors' drop down menu the data being saved upon a selection being made is the 'id' pertient to the relevant detector e.g. 'Detector1' is selected and the 'id' value of '1' is saved which is exactly what I want. However when it comes to the second drop down menu, the value saved is the text value that the user selects, rather than the 'id'. e.g. 'Deep Search Head ' rather than an 'id' of '1'. Could someone perhaps tell me please what I need to change so that the 'id' value is saved rather than the text value. If it helps, the coding is taken from the following http://www.plus2net.com/php_tutorial/ajax_drop_down_list.php. Many thanks and kind regards. Chris
×
×
  • 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.