Jump to content

A JM

Members
  • Posts

    249
  • Joined

  • Last visited

Everything posted by A JM

  1. I see your point about validating the URL... So, how should I go about doing this? I need the user to be able to delete a file by either a hyperlink, button, etc. Since the page lists the files in a directory after the delete I need to refresh the page... this is definitely new territory for me.
  2. I'm trying to delete a file but am having some problems, can someone help? The script doesn't seem to be working as I don't get prompted "Are you sure?"... Any help would be appreciated - maybe there is an easier way to do this? Thanks. <!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"> <head> <?php // user has clicked a delete hyperlink if($_GET['action'] && $_GET['action'] == 'delete') { unlink($_GET['filedelete']); header("Location:files.php"); exit(); } ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> </head> <body> <?php $path = "../temp/" . $_GET['ID'] . "/"; $dir = dir($path); while($file = $dir->read()) { if($file != '.' && $file != '..') echo '<a href="' . $path . $file . '">' . $file . '</a> <input type="button" value="Delete" name=filedelete onClick="if(confirm(Are you sure?)){ window.location=\adm_file_list.php?delete=' .$path . $file. '\'; }"><br/>'; }?> </body> </html>
  3. I just went ahead and added a hidden textbox. Thanks anyway guys. A JM,
  4. <td colspan="4" align="left"><strong>Report Number: <?php echo htmlentities($row_rstdetail['num'], ENT_COMPAT, 'utf-8'); ?></strong></td>
  5. I'm noticing that I can't get the $_POST value from a recordset field on my form unless I use a textbox or something that has a name or id, just a guess? I'm currently just using the field as a label and need the value associated with the label is there a way to get it without assigning the field to textbox and using name or id what am I missing here? Thanks. A JM,
  6. No suggestion on dealing with empty recordsets - I find that hard to believe... hmmm.. :-\
  7. I'm wondering what the best way is to handle an empty recordset while using Dynamic data on my form. Is there a way to possibly redirect the user to another page, post a message to the user or disable all options on my form as opposed to showing them a page with form headings and option buttons on the form but no data? If the user clicks on an option button with no data it causes problems... any thoughts or ideas on how to resolve this problem? A JM,
  8. I finally got it, with a little help from AlexWD..! In case anyone is interested. <iframe src="file_list.php?ID=<?php echo $colname_rstConfirm; ?>" name="filelist_frame" width="500" height="175" frameborder="0"></iframe> <body> <?php $path = "../claims/" . $_GET['ID'] . "/"; $dir = dir($path); while($file = $dir->read()) { if($file != '.' && $file != '..') echo '<a href="' . $path . $file . '">' . $file . '</a><br />'; }?> </body> Thanks for letting me vent. I've still got to work on file section but I think now that I can refresh a portion of the page without submitting the entire page I hope I can figure it out. A JM,
  9. Thanks, I was getting close but couldn't get it.. :-\ <?php $path = "../claims/" . $_GET['ID'] . "/"; $dir = dir($path); while($file = $dir->read()) { if($file != '.') && ($file != '..') { echo '<a href="' . $path . $file . '">' . $file . '</a><br />'; } }?>
  10. How can I eliminate the root paths from being read using thedir() function? <?php $path = "../claims/" . $row_rstocdetail['maxclaimnum'] . "/"; $dir = dir($path); while($file = $dir->dir()) { echo '<a href="' . $file . '">' . $file . '</a><BR>'; }?> The files that come out are as follows: . .. myfilename1.txt myfilename2.txt ... etc. how can I eleiminate the first 2 items and just list the filenames? myfilename1.txt myfilename2.txt ... etc. Thanks. A JM,
  11. I've been trying to get the Iframe scenario going and I think this will work but am having problems passing a recordset field to the Iframe, can anyone help? My recordset field that I want to pass from the main form is: $row_rstocdetail['maxclaimnum'] <iframe src="file_list.php?ID=<?php $row_rstocdetail['maxclaimnum'] ?>" name="filelist_frame" width=835 height=60></iframe> On the Iframe page I have the following: <body> <?php $path = "../myfolder/" . $GET['ID'] . "/"; $dir = dir($path); while($file = $dir->read()) { echo '<a href="' . $path . $file . '">' . $file . '</a><br />'; }?> </body>
  12. I wanted to ask an additional question or add some additional comments. Would it be possible to do this in Iframes? When my page loads it runs a script to populate the existing files in the directory for this recordset associated with this user. Can I use an Iframe to display the files in that directory and then use another Iframe for the file upload routine that would allow the end user to add additional files and then update the original Iframe with the new files that were just uploaded? I think that will do what I'm looking for... Can I simply use the variables/recordset fields from the SQL query that I am currently using on the main form to populate the Iframe instead or do I have to go about that differently and somehow pass the variable/recordset fields to the Iframe? Thanks.
  13. The user should be able to do both. What I've done to alleviate writing the actual file paths to the DB is that I've create a directory associated with the recordset and that is recorded in the DB, this allows the user to upload as many files as needed and each file doesn't need to be individually recorded in the DB. I found this example of uploading multiple files I'm just not sure how to implement the script with regard to PHP (http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/) The example appears to be "real time" updating the page which is what I'm looking for but I'm not sure how it would be implemented in my example. How do I use that with PHP?? I'm still looking for thoughts and ideas on how to be able to implement so I'm open....
  14. No sorry. I'm trying to figure out the process of how to allow a user to upload additional files to my page and refresh the page with the newly uploaded files, does that make it any clearer? Currently my page reads from a recordset and fills in some fields on a form - the end user has the capability to change these fields and then save the form with the new changes. I want to allow the user the capability to also add an additional file(s) to the DB. I think my confusion is coming from needing to use "Submit" to "Upload" the files and currently "Submit" is used for updating the DB record... Am I making any sense? Thanks.
  15. I'm running into a slight problem trying to figure out how to allow my users to add additional files to my DB (link only). Currently when my page loads it reads the files in a particular (uploaded from another form) directory from the server and using the following script which works perfectly. $path = 'some path here'; $dir = dir($path); while($file = $dir->read()) { echo $file . ' - <a href="' . $path . $file . '">' . $file . '</a>'; } My problem is that I want to allow the user to upload additional files and I want the links to appear on the first page after they upload the new file(s). I'm trying to figure out how to make this work - should I redirect them to another page; use javascript or ajax or some other technology??? I could really use some expertise on this one I'm a bit out of my league here... Any help or suggestions would greatly be appreciated. Thanks. A JM,
  16. K, finally figured this out using javascript. Thanks to all that helped. <script> function onSubmit() { if (confirm("Finalize for Management review?")) { document.getElementById("form1").elements["submit_for_review"].value = '1'; document.getElementById("form1").submit(); } else { document.getElementById("form1").elements["submit_for_review"].value = '0'; document.getElementById("form1").submit(); } } </script> I also realized that PHP script is read from top down (duh!) so if I wanted a script to run prior to another I just had to load it at the top of the page... A JM,
  17. OK, makes sense. So, if I use a hidden textbox and set the variable from Javascript that should work correct? <script> function onSubmit() { if (confirm("Finalize for Management review?")) { document.getElementById("form1").elements["submit_for_review"].value = '1'; document.getElementById("form1").submit(); } else { document.getElementById("form1").elements["submit_for_review"].value = '0'; } } </script> Any ideas about
  18. I'm also noticing that the variable that is being set in the <SCRIPT> is not available to PHP, is that correct? Thanks,
  19. This doesn't seem to be working the way that I think it should so I must not be doing this correctly, hopefully someone can straighten me out... My button on my form has the following: <input type="button" name="submit_revision" value="Save Changes" onClick="onSubmit()"/> my form: <form action="<?php echo $editFormAction2; ?>" method="post" id="form1" enctype="multipart/form-data"> ....other PHP stuff.... <script> function onSubmit() { if (confirm("Finalize for Management review?")) { $submit_for_review = 1; document.getElementById("form1").submit(); //confirm($submit_for_review); //exit(); } else { $submit_for_review = 0; // don't submit the form //confirm($submit_for_review); //exit(); } } </script> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $editFormAction2 = $_SERVER['PHP_SELF']; print_r("it submitted"); exit; } ?> My interpretation of the above is that when the form is submitted it would run $editFormAction2 but it isn't....???? not sure why though. Also, the confirm() can it be a "YES"/"NO" as opposed to an "OK"/"CANCEL"??? Thanks,
  20. I'm trying to set a value for a variable for TRUE $myvariable =1 and for FALSE $myvariable=0. The script worked perfectly - last question on this... My form has the following action: <form action="<?php echo $editFormAction2; ?>" method="post" id="form1" enctype="multipart/form-data"> When the form is submitted by document.getElementById("form_id").submit(); will it run the action part of the form or do I need to kick that off in he script somehow <?php echo $editFormAction2; ?>? Thanks.
  21. OK, gotcha. This doesn't return a variable of TRUE/FALSE only waits for the user to click YES/NO. To return a variable with TRUE/FALSE I need to go with the script in the head section. <button onclick="onSubmit()">Submit Form</button> <script> function onSubmit() { if (confirm("Do you really want to do that?")) { $myYESvariable = 'TRUE'; document.getElementById("form_id").submit(); } else { $myNOvariable = 'FALSE'; // don't submit the form } } </script>
  22. Makes sense, this runs from the button as opposed to the head and is more compact. How do I capture the value from return whether it be TRUE/FALSE or is 'return' the variable that I can use? A JM,
  23. Thanks for the posts. I'm still a bit green with working with forms, php,etc. From an implementation standpoint, I think the the full script makes more sense. The button on my form should still be a SUBMIT correct? How do I exit the script without submitting the form just don't process a SUBMIT? Will look something like this? <script> function onSubmit() { if (confirm("Do you really want to do that?")) { document.getElementById("form_id").submit(); } else { // don't submit the form } } </script>
  24. I want to ask the user a question and receive an answer before SUBMITTING my form how would I go about achieving that? For example: Before saving my forms information to the DB I want to ask the user with a pop-up if they are ready to finalize the document, wait for their answer, yes/no and save their choice as a variable. Can this be done via PHP or is this more of a javascript issue? Thanks. A JM,
  25. Thanks for the ideas. A JM,
×
×
  • 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.