Jump to content

A JM

Members
  • Posts

    249
  • Joined

  • Last visited

Everything posted by A JM

  1. That totally makes sense Mchl - essentially that would be a DB query based upon the Invoice number from the $_SESSION I assume, correct? It's making more sense now. After my user submits the form and if I don't unset the $_SESSION what happens if they hit the back button - does that create a problem since the data still exists in the $_SESSION? Also, do you guys mind if I ask a question about printing an Invoice/Confirmation. Do you just use the File/Print option in the browser or is there a better way to print off an Invoice/Confirmation? Thanks for all the input. A JM,
  2. Thanks bobcatM that confirms my assumptions. My page that submits to the DB has a session set and does not have an unset. So, does that mean that after I submit the records to the DB and I redirect to my invoice page that the fields will be available until I unset the session or leave the site? Thanks,
  3. I do have an auto increment item... so I assume this will need to come directly from the DB... Since the session stores information from the page how does it store text fields - is it by the name of the textbox? I assume I could query the DB for the Invoice number on the page load unless there would be a better way of doing it? Thanks,
  4. What is the best way to create an Invoice/Confirmation page after a form has submitted my data to a mySQL database? Should I query the database based upon some field and retrieve the information or pass the information from the form page after the submit to the new page? Can someone help me get started on this.. I'm still getting to know php and I believe using $SESSION and an array might be the way to go. Thanks. A JM,
  5. Sorry, I didn't mean to over simplify. Can you tell me a little more about enctype="multipart/form-data"? How will adding this to the form tag and adding the input allow it identify the php script that I want it to run, I was calling the page upload.php directly? I'm just a little confused after thinking about implementation... Would I use something like if( isset($_POST['submit']))
  6. Just making sure I understand you. Instead of having a separate file with my script "upload.php" copy it into the DB page and add the enctype="" into the form tag and all should be good? Thanks. A JM,
  7. I think I'm getting a clearer picture of why the submit is not working but I still don't know how to solve the problem. I mistyped in my original question - one of my two forms uploads a file to the server and the other enters a record in the DB, I need to merge them together. How do I get a submit to run a SQL query and kick off another php script? The Form action from what I can find will only do one or the other not both so it has to come from within php somewhere... Thanks for any help. A JM,
  8. I've been running in test a form that will allow me to upload file paths to my DB and have that fully functional. I also have a form that I use to submit records to my DB and it also is working fine. Here's my problem, I want to combine the two together and am confused on how to implement. My form tag for the working DB is: <form action="<?php echo $editFormAction; ?>" method="post" id="form1"> and my form tag for my working file upload is: <form action="upload.php" method="post" enctype="multipart/form-data"> How do I get these to work together- I'm still on a steep learning curve here so go easy on me.. since my upload script lives on upload.php how can I have my DB run both, or am I doing this wrong? :-\ Thanks for any advice and help you can give. A JM, [EDIT] noodling on this here.. should I call the upload.php from $editFormAction portion of the other php script???
  9. With regard to the Break; comment do you mean to not check for $newfilename = true; instead just use break;? I'll still need the variable though correct (while ( $newfname == false )) otherwise there's nothing for it to loop against? Thanks for the post premiso but I'm working in PHP and not that familiar with javascript. A JM,
  10. I want to test for the existence of a file in the directory before saving. If the file already exists then I want to increment the file name by appending a number to end of the file name, then save the file. The caveat for this file save routine is that if this process has happend before, filename1.pdf exists then the new file should increment one more number to filename2.pdf, etc... I'm not familiar with loops and wanted to make sure that there isn't an easier/better way to do this, any ideas or thoughts? I hacked this up and I think will work???? Thanks. A JM,
  11. Thanks for the curdate() function. I did have the field set for 'timestamp' but have since changed it to 'datetime'; I believe they both will accept date/time...? Curdate() does fill the field with the date but not the time, any ideas? I believe the following is used by Dreamweaver and is not a standard PHP function (GetSQLValueString($date, "date")) but I could be wrong... how would i simply edit the sql statement with an item in the middle of the variable list? I think I'm getting closer... "Date type columns are not strings" - this got me thinking about the above function and that it won't work in the above situation. A JM, [edit] got it - see the following for a couple of examples (http://www.gizmola.com/blog/archives/51-Exploring-Mysql-CURDATE-and-NOW.-The-same-but-different..html)
  12. Thanks for the curdate() function. I did have the field set for 'timestamp' but have since changed it to 'datetime'. Curdate() does fill the field with the date but not the time, any ideas? A JM,
  13. Trying something a little different using a variable $date and not able to get the time and date together only the date??? A JM,
  14. The column 'new_timestamp' does exist in the table. Since I'm still pretty green with PHP I assume that is used to pull the information from my form and then place that variable into %s is this correct? A JM,
  15. I have a form and an INSERT statement for my DB on my page; I want to add a timestamp to one of the fields in my DB and I though I could just simply add it to the SQL statement is there something special to doing this? This is the original: Modified: Can anyone help with this? Thanks. A JM,
  16. Thanks for your help! I think I'm rolling now... A JM,
  17. The last part of my original question.. sorry. How do avoid the end user from viewing files in the directory? When I uploaded the file a moment ago it works fine but I can also see the contents of the directory by simply pointing my browser to www.myweb.com/files/ is there a way to avoid this so that the user cannot see the files? Thanks. A JM,
  18. ahhh... the same directory as the script, that worked thanks. Last question on the subject - since my script is on an individual page and the code is executed from another pages form it outputs a "Success" or "Failure" but leaves no links to my previous page, just leaves the user hanging. Do I have this setup incorrectly since I want the users redirected back to my original page? All the file load script examples that I've seen are run from a second page, one page is the form the other the script. This redirects the user away from the main page I want them to stay on the main page. Is there a problem running the script on the same page as the form and can I use a message box to let the user know of any messages with regard to the file upload? is this a security risk? Thanks,
  19. Thanks for the posts guys - very helpful. Zhadus - I'm glad you mentioned checking for the existence of the file a second time as I guess it's always possible for a file to have to be renamed again. Since php.ini will know the temp directory - I'll just need to assign the actual "move to directory" in the script, gotcha. What permissions do I need to assign to the directory and what user? How is the path structured in the script ("/home/user/etc..") or something different? Since I need the file names to be something meaningful for the end user. Maybe I should rethink how to handle the uploading of files. Here's my concept, I would like to allow my end user to upload as many files as they want or need with some way for them to download them at a later time by using a drop down list or links, etc. Since I will have multiple files for one record in my DB I thought the best way to do this was to create a directory for each new record with a recordID as the directory name and then to drop all my files into the new directory, what do you guys think? A JM,
  20. I'm surprised that no one has any answers to setting up the php.ini file and how the directory's work.. When setting the 'upload_tmp_dir' in the php.ini file - after it is set do I need to tell my script what that temp folder is? How do I tell the function 'move_uploaded_file()' where to move my files given I have virtual servers running? Thanks,
  21. "Hello" - this is my first post! I'm very new to php and am trying to implement a file upload utility and am wanting to ask a few questions with regard to file directory's, storage, etc. Initially when setting up the script I'm to set up a directory - from what I read this directory is a temp directory, correct? does it matter where this directory is located or what it's called, what's the norm? Secondly I want to avoid users from "backing up the tree" to view files in other directory's . I understand that I'm supposed to "move away from the web root" could someone elaborate a little on that subject? My server currently is setup like /home/usersdomain so if I were to "move away from webroot" I would be in /home if I interpret that correctly.. When checking for files and finding a duplicate how does php handle replacing them? will it simply overwrite a file that is uploaded with the same name? Does someone have a routine to stop this before it happens by checking and renaming the file being uploaded? Thanks for any ideas or suggestions that you might have. 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.