Jump to content

jamesadrian

Members
  • Posts

    69
  • Joined

  • Last visited

Everything posted by jamesadrian

  1. dsonesuk, Thank you for this information. I will now start in on the tutorial. Jim Adrian
  2. dsonesuk, You included in your solution to the contact form problem a script that I assume is java script. I know nothing about it, but I am happily using it. I surely need to learn about it. Would you give me a brief description of what this particular scrip does? <script> window.onload = function() { var myForm = document.getElementById("myForm"); myForm.onsubmit = function() { for (i = 0; i < myForm.elements.length; i++) { var convert = ""; if (myForm.elements[i].type !== "submit" && myForm.elements[i].type !== "reset" && myForm.elements[i].type !== "hidden") { convert = myForm.elements[i].name.replace('Tmp', ''); var input = document.createElement("input"); input.setAttribute("type", "hidden"); input.setAttribute("name", convert); input.setAttribute("value", myForm.elements[i].value); myForm.appendChild(input); myForm.elements[i].value = ""; } } return true; }; }; </script> Thank you for your help. Jim Adrian
  3. dsonesuk, I don't know how I missed it all this time. http://www.needsnotmet.com/ looks better now. Thank you. Jim Adrian
  4. In the website php contact script and html form that we have been discussing, I find a problem that I have encountered before. I haven't found a remedy. In the last two lines of the form below there is a submit button and a send button. The text size for the word SEND and for Clear Form is something I would like larger, but I cannot find a way to control it from within the form. <form id="myForm" method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"> Name<br /> <input type="text" name="NameTmp" value="" size="29" maxlength="75"> <br /> Email Address<br /> <input type="text" name="EmailTmp" value="" size="29" maxlength="75"> <br /><br /> Questions and Comments about Needs Not Met: <br /><br /> <textarea name="CommentsTmp" rows="12" cols="60"> </textarea> <br /><br /> This window will scroll for long messages. <br /><br /> <input type="submit" name="Submit" style="width:100px; height:100px;" value="SEND" /> <input type="reset" style="width:100px; height:100px;" value="Clear Form"> </form> I have tried many suggestions from several websites, but nothing works. Does anybody here know how to do it? It can bee seen at the top of http://www.needsnotmet.com. Thank you for your help. Jim Adrian
  5. dsonesuk, This is a very valuable script. Thank you. Jim Adrian
  6. Does anybody know how to prevent the back arrow from refilling the form? Thank you for your help. Jim Adrian
  7. Yes. This problem exists at futurebeacon.com and also in http://www.needsnotmet.com/contactnnm.php Futurebeacon uses a script provided by godaddy.com (my hosting service) called gdform.php. I have not access to its details. The letter page contains a script written by me. Here is the code for the whole page: <?php if (isset($_POST['Submit'])) { // get posted data into local variables $From = "Contact Form at http://www.needsnotmet.com/contactnnm.php"; $EmailTo = "contact@needsnotmet.com"; $Subject = "Update Request"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Comments = Trim(stripslashes($_POST['Comments'])); // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($Email)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.needsnotmet.com/error.htm\">"; exit; } // prepare email body text $Body =""; $Body .= "\n"; $Body .= "\n"; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "\n"; $Body .= "Email Address: "; $Body .= $Email; $Body .= "\n"; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; $Body .= "\n"; $Body .= "From: "; $Body .= $From; $Body .= "\n"; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$From>"); // Print style redirect to success page: if ($success){ print "<meta http-equiv=\"refresh\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.needsnotmet.com/error.htm\">"; } } ?> <!DOCTYPE html> <html> <head> <title>Contact</title> <meta name="description" content=""> <meta name="keywords" content=""> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="background-image: url(http://www.needsnotmet.com/bluesky.png);"> <div style="width: 3000px; height: 3000px; font-size: 20px; line-height: 28px; color: #000000; font-family: times new roman;"> <div style="margin-left: 60px; margin-right: 0px;"> <br /><br /> <div style="font-size: 30px; line-height: 5px;">This is your contact with NeedsNotMet.com </div> <br /><br /> <br /><br /> <div style="width: 1000px;"> Your email address will not be shared with others. <br /><br /> <br /><br /> <!-- Website Contact Form--> <form method="POST" action="<?php echo $PHP_SELF;?>"> Name<br /> <input type="text" name="Name" value="" size="29" maxlength="75"> <br /> Email Address<br /> <input type="text" name="Email" value="" size="29" maxlength="75"> <br /><br /> <div style="position: absolute; top: 440px; left: 60px;"> <br /><br /> Questions and Comments: <br /><br /> <textarea name="Comments" rows="12" cols="70"> </textarea> <br /><br /> <br /><br /> <input type="submit" name="Submit" value="Submit Form"> <br /><br /> <input type="reset" value="Clear Form"> </div> </form> </div> </div> </div> </body> </html> I can't spot the feature that is responsible. Thank you for your help. Jim Adrian
  8. I have another problem with the script which I find is also a problem with the similar script provided by godaddy.com. The script succeeds and clears the entered data but when you use the back arrow to go back to the page that you came from it fills the values back into the form and you go back only by hitting the back arrow a second time. Is there any way to correct this? Thank you for your help. Jim Adrian
  9. I'm sorry to say that I could not make the header commands work. Jim Adrian
  10. Thank you for this information. I think that you advise that I substitute the header commands for the java script and do without the java script. I don't yet see where the header commands should be placed in the code. At the beginning? I am studying the link you provided including the links it leads to. Perhaps I should google header commends. I am new to this. Thank you for your help. Jim Adrian
  11. I have another question about the php script and html contact form that I have been working on. The contact page at needsnotmet.com/contactnnm.php is working fine except that I hope to have the form automatically cleared when sending is successful. Can anybody here tell me how that is done? The page at futurebeacon.com does it, but only because of a hidden script offered by the godaddy.com hosting service. I can't find out from them. For some reason, viewing codes does not get you the whole thing, so here is the page source: <?php if (isset($_POST['Submit'])) { // get posted data into local variables $From = "Contact Form at http://www.needsnotmet.com/contactnnm.php"; $EmailTo = "contact@needsnotmet.com"; $Subject = "Update Request"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Comments = Trim(stripslashes($_POST['Comments'])); // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($Email)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.needsnotmet.com/error.htm\">"; exit; } // prepare email body text $Body =""; $Body .= "\n"; $Body .= "\n"; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "\n"; $Body .= "Email Address: "; $Body .= $Email; $Body .= "\n"; $Body .= "\n"; $Body .= "Comments: "; $Body .= $Comments; $Body .= "\n"; $Body .= "\n"; $Body .= "From: "; $Body .= $From; $Body .= "\n"; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$From>"); // Print style redirect to success page: if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.needsnotmet.com/ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.needsnotmet.com/error.htm\">"; } } ?> <!DOCTYPE html> <html> <head> <title>Contact</title> <meta name="description" content=""> <meta name="keywords" content=""> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="background-image: url(http://www.needsnotmet.com/bluesky.png);"> <div style="width: 3000px; height: 3000px; font-size: 20px; line-height: 28px; color: #000000; font-family: times new roman;"> <div style="margin-left: 60px; margin-right: 0px;"> <br /><br /> <div style="font-size: 30px; line-height: 5px;">This is your contact with NeedsNotMet.com </div> <br /><br /> <br /><br /> <div style="width: 1000px;"> Your email address will not be shared with others. <br /><br /> <br /><br /> <!-- Website Contact Form--> <form method="POST" action="<?php echo $PHP_SELF;?>"> Name<br /> <input type="text" name="Name" value="" size="29" maxlength="75"> <br /> Email Address<br /> <input type="text" name="Email" value="" size="29" maxlength="75"> <br /><br /> <div style="position: absolute; top: 440px; left: 60px;"> <br /><br /> Questions and Comments: <br /><br /> <textarea name="Comments" rows="12" cols="70"> </textarea> <br /><br /> <br /><br /> <input type="submit" name="Submit" value="Submit Form"> <br /><br /> <input type="reset" value="Clear Form"> </div> </form> </div> </div> </div> </body> </html> Thank you for your help. Jim Adrian jim@futurebeacon.com
  12. What does this line mean? <form method="POST" action="<?php echo $PHP_SELF;?>"> Its the action part I don't understand. Thank you for your help. Jim Adrian
  13. I appreciate your help with this and I have made several changes. I separated the form from the php file which is now called recent.php and operates from my hosing account and is not on the website page. Located on a website page, the form is now this: <!-- Website Contact Form--> <form action="recent.php" method="post"> Name <br /> <input type="text" name="Name" value="" size="29" maxlength="75"> <br /><br /> Email Address <br /> <input type="text" name="Email" value="" size="29" maxlength="75"> <br /><br /> <br /><br /> Questions and Comments: <br /><br /> <textarea name="Comments" rows="12" cols="70"> </textarea> <br /><br /> <br /><br /> <input type="submit" name="Submit" value="Submit Form"> <br /><br /> <input type="reset" value="Clear Form"> </form> Here is recent.php: <?php if (isset($_POST['Submit'])) { // get posted data into local variables $EmailFrom = "Contact Form at http://www.fibro1.org"; $EmailTo = "jim@futurebeacon.com"; $Subject = "Update Request"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); $Comments = Trim(stripslashes($_POST['Comments'])); // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($Email)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.fibro1.org/error.htm\">"; exit; } // prepare email body text $Body =""; $Body .= "\n"; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Comments:"; $Body .= $Comments; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Comments, $Body, "From: <$EmailFrom>"); // Print style redirect to success page: if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.fibro1.org/ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.fibro1.org/error.htm\">"; } } ?> I am stumped because there are no error messages and yet the email does not arive. Thank you for your help. Jim Adrian jim@futurebeacon.com
  14. 88 people have looked at this so far. Have I posted this in the wrong place? Thank you for your help. Jim Adrian jim@futurebeacon.com
  15. I have attempted to write a page at http://www.futurebeacon.com/test.php that has a form window for a name, a form window for an email address and a form window for comments. The comment window never comes through with the email message sent to update@futurebeacon.com and I don't know what the script or the html form lack. Here they are: <?php if (isset($_POST['Submit'])) { // get posted data into local variables $EmailFrom = "Contact Form at http://www.futurebeacon.com"; $EmailTo = "update@futurebeacon.com"; $Subject = "Update Request"; $Name = Trim(stripslashes($_POST['Name'])); $Email = Trim(stripslashes($_POST['Email'])); // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($Email)=="") $validationOK=false; //if (Trim($Website)=="") $validationOK=false; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.futurebeacon.com/error.htm\">"; exit; } // prepare email body text $Body =""; $Body .= "\n"; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // Print style redirect to success page: if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.futurebeacon.com/ok.htm\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.futurebeacon.com/error.htm\">"; } } ?> <!DOCTYPE html> <html> <head> <title>PHP Test</title> <meta name="description" content=""> <meta name="keywords" content=""> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body style="background-image: url(http://www.fibro1.org/Fibro1.png);"> <div style="width: 3000px; height: 3000px; font-size: 20px; line-height: 28px; color: #000000; font-family: times new roman;"> <div style="margin-left: 60px; margin-right: 0px;"> <br /><br /> <div style="font-size: 35px; line-height: 5px;">PHP Test </div> <br /><br /> <br /><br /> <br /><br /> <div style="width: 1000px;"> To receive email updates, please enter your name and email address bellow. This information will not be shared with others. <br /><br /> <!-- Website Contact Form--> <form method="POST" action="<?php echo $PHP_SELF;?>"> Name<br /> <input type="text" name="Name" value="" size="29" maxlength="75"> <br /> Email Address<br /> <input type="text" name="Email" value="" size="29" maxlength="75"> <br /><br /> <div style="position: absolute; top: 440px; left: 60px;"> <br /><br /> Questions and Comments: <br /><br /> <textarea name="Comments" rows="12" cols="70"> </textarea> <br /><br /> <br /><br /> <input type="submit" name="Submit" value="Submit Form"> <br /><br /> <input type="reset" value="Clear Form"> </div> </form> </div> </div> </div> </body> </html> I think that the php file needs to somehow enable the part of the html form that contains the comment window, but I am not sure and I wouldn't know how. The name and email address come with the message correctly. Any hints would be greatly appreciated. Thank you for your help. Jim Adrian jim@futurebeacon.com
  16. How does one delete a post? Thank you for your help. Jim Adrian
  17. Foxy Mod, Apparently, I must have done something wrong on my first test of this new script. It has worked properly ever since. Thank you for your reply. Jim Adrian
  18. I tried a scrpt that only uploads zip files but it doesn't work either: <?php ini_set('file_uploads', 'on'); $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 20000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "zip") { echo "Sorry, only zip files are accepted."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; } else { // if everything is ok, try to upload file if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename($_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } ?>
  19. This attempt is constructed from W3 Schools guidance. It seems strange that there are no responses. How do I ask an administrator or moderator about this? Thank you for your help. Jim Adrian jim@futurebeacon.com
  20. I forgot to mention the form on the web page: <form action="upload.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> I also made the web page character set enctype: <meta http-equiv="Content-Type" content="text/html; charset=enctype" /> This all takes place on a new page here: http://www.fibro1.org/ Thank you for your help. Jim Adrian jim@futurebeacon.com
  21. I wish to know what html form and script I must have on my website in order to allow visitors to my website to upload a zip file containing a video file. I have been given a first draft of a script that attempts to upload pictures, but it doesn't work yet: <?php ini_set('file_uploads', 'on'); $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 20000000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "mpg" && $imageFileType != "webm" && $imageFileType != "gov" && $imageFileType != "mp4" && $imageFileType != "avi" && $imageFileType != "mov") { echo "Sorry, only video files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "The file ". basename($_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } ?> I also made a directory within the directory that contains upload.php called uploads, which seems to be consistent with the script. I would be happy if it only could upload zip files. Can anybody here suggest what I should do? Thank you for your help. Jim Adrian jim@futurebeacon.com
  22. I would like to write a drop-down menu in my web page that has links in it that can be clicked on in order to go to another URL, but I would lke to accomplish this without having an external CSS file or any file or code that is not actually in the web page that contains the drop-down menu. I do not want to use any scripting language either (no JAVA Script or PHP) - just HTML. Is this possible? Also, Is it true that any drop-down menu that offers links to click on must be part of an HTML Form within the HTML source code? Thank you for your help. Jim Adrian
  23. dsonesuk, Thank you for solving this for me. You have given me a general solution. Jim Adrian
×
×
  • Create New...