craigeves Posted February 16, 2009 Share Posted February 16, 2009 I have the following code as a .php file on my server. Everything works great... but now I want to be able to click on 'Click Here to tell us we can print your photo' button (yet to be created), and for it to remember the password inputed, open a new page with a form on it and paste the password into a text box so the user doesn't have to. Can this be done without breaking the code below? Many thanks Craig <?php if (isset($_GET['image'])) { $path = "proofs/{$_GET['image']}.jpg"; if (file_exists($path)) { //we're good printf('<div><p>Here is your photo for proofing:<p><img src="%s" alt=""/></div>', htmlentities($path, ENT_QUOTES)); echo "Send your sales excecutive an email to confirm that your proof is OK to proof.<p>If you wish to proof another design please input the password below. "; } else { echo "<p>Image could not be found, please try again.</p>"; } } //redisplay form anyway since it's easier than having to go back every time ?> <p>To save time we allow you to proof your designs online by entering your password in the form field below.</p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <p> <input type="text" name="image" /> </p> <p> <input type="submit" value="Submit" /> </p> </form> Quote Link to comment Share on other sites More sharing options...
drisate Posted February 16, 2009 Share Posted February 16, 2009 Why not just do this? <?php if ($_GET[check]){ if (isset($_GET['image'])) { $path = "proofs/{$_GET['image']}.jpg"; if (file_exists($path)) { //we're good printf('<div><p>Here is your photo for proofing:<p><img src="%s" alt=""/></div>', htmlentities($path, ENT_QUOTES)); echo "Send your sales excecutive an email to confirm that your proof is OK to proof.<p>If you wish to proof another design please input the password below. "; } else { echo "<p>Image could not be found, please try again.</p>"; } } }else{ echo "You did not check the check boxe"; } //redisplay form anyway since it's easier than having to go back every time ?> <p>To save time we allow you to proof your designs online by entering your password in the form field below.</p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <p> <input type="text" name="image" size="20" /> </p> <p> <input type="checkbox" name="check" value="ON"> click here for blah ...</p> <p> <input type="submit" value="Submit" /> </p> </form> Quote Link to comment Share on other sites More sharing options...
craigeves Posted February 17, 2009 Author Share Posted February 17, 2009 Thanks for replying. I don't wish to do that as it is not what is required... Let me explain a little further what I am after. 1. The above script shows an image when a password is inputed into the text field and the submit button is pressed. It searches the server for 'password'.jpg. Underneath the image the words 'Confirm that this image is OK to print' is displayed. Clicking on that will take you to a form on a seperate page. 2. The value of the password field on the previous page should be remembered and displayed in a new field on the new page. I can do the rest from here, but I don't know how to get the above working + i don't want to break the code i am already using so it must be able to tie-in with the code above. Can anyone else help? Thanks in advance. Craig Quote Link to comment Share on other sites More sharing options...
craigeves Posted February 18, 2009 Author Share Posted February 18, 2009 Bump Quote Link to comment Share on other sites More sharing options...
craigeves Posted February 24, 2009 Author Share Posted February 24, 2009 Can anyone else help at all? Quote Link to comment Share on other sites More sharing options...
sarah_9 Posted February 24, 2009 Share Posted February 24, 2009 Hello, Have you tried to search on google, google will help you in finding the right code. Regards, sarah_9 Outsource PHP Project Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.