Jump to content

jan23778

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jan23778's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. One more question if I may. When would you use Javascript and when would you use PHP?
  2. Hi all, Thank you for your advice, I do want to learn PHP so please do not think I just pasted some code I found and wanted you all to do my work for me. I will carry on and become good, I am not one to quit anything!! I am really enjoying trying to learn something new and its nice to know there is so much help available when it is needed. Keep up the good work and I am sure you will hear from me again the next time something trips me up.
  3. You are right, I am unfamiliar with PHP. I have a book on Javascript that I am trying to follow and have been following some tutorials on PHP as well (and trying to amend the script to fit my needs). I have done a basic website for a friend of mine. I was without a job for a period of time and therefore wouldn't have minded spending a lot of time learning PHP, but have recently got back into employment and have found myself really short on time. I have left his website unfinished and I guess I was looking for a shortcut to be able to finish his site off. I will go on to www.tizag.com to try and start form scratch again instead of trying to combine 5 different tutorials into one. Thanks for the advice
  4. Ah OK, What I wanted is to send the message "Sin Mensaje" if the "detalles" field was left blank otherwise go to the next section (Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise.) Would I be missing anything if I just changed that to: }if ($detalles == "") Also to send the details ($email, $contactname, $telephone, $email, $detalles, $tipo) to the recipient (jan_colombini@hotmail.com) have I got this section right? mail($recipient, $email, $contactname, $telephone, $email, $detalles, $tipo); It doesn't make sense to me as it seems to suggest that it will mail the recipient field (my email address) along with all the other details but I do not know how to tell it to mail the detail TO me. As I said I am still very new and it seems like I am trying to learn another language!!! (and with a different alphabet) Thank you again for all your help, if you have any other suggestions they would be gratefully received!!
  5. Hi and thanks for the replies, I have now put the error handling at the top but nothing has changed. I am sorry but I am very very new to this. How does the error handler work? Should it show the errors when I press submit? I put it at the top, filled in the form and pressed submit but it still just shows a blank page. Do you have any more advice? I really want to get this to work and would be a huge step for me. By the way I did not change the opening if statement (I did not miss it when pasting it just is not there) as I am not 100% sure of what it should contain. I have changed this script so much that I am completely lost!!!! <?php /** error handler ** set error reporting level to 0 for live site, 1 for dev */ ini_set("display_errors", 1); ERROR_REPORTING(E_ALL); $send = true; $email = $_POST['email']; $contactname = $_POST['contactname']; $telephone = $_POST['telephone']; $email = $_POST['email']; $detalles = $_POST['detalles']; $tipo = $_POST['tipo']; $recipient = "jan_colombini@hotmail.com"; $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) or die("<h4>Correo Invalido</h4> <a href='javascript:history.back(1);'>Atras</a>"); echo "<a href='javascript:history.back(1);'>Atras</a>"; } elseif ($detalles == "") { echo "<h4>Sin Mensaje</h4>"; echo "<a href='javascript:history.back(1);'>Atras</a>"; } /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */ if($send != false) { mail($recipient, $email, $contactname, $telephone, $email, $detalles, $tipo); echo "<h4>Su mensaje ha sido enviado</h4>"; } else { echo "<h4>No se ha realizado el envio de informaciones a $email</h4>"; } ?> Thank you all for your help (and patience) I do appreciate it!!
  6. Hi everyone. I am very new to PHP and have been trying to write a form processing script form about a month now with no joy. I am slowly becoming insane and have teared half of my hair out already!! Any help anyone can give me would be much appreciated. Whenever I upload this script to my website (well one that I am trying to do for a friend), fill in the fields and press submit a blank page comes up. I really do not know what more to do and am becoming desperate. Just to be an even bigger pain in the backside I have to tell you that my friend is Spanish and so is the website! The PHP is the following: <?php $send = true; $email = $_POST['email']; $contactname = $_POST['contactname']; $telephone = $_POST['telephone']; $email = $_POST['email']; $detalles = $_POST['detalles']; $tipo = $_POST['tipo']; $recipient = "jan_colombini@hotmail.com"; $email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) or die("<h4>Correo Invalido</h4> <a href='javascript:history.back(1);'>Atras</a>"); echo "<a href='javascript:history.back(1);'>Atras</a>"; } elseif ($detalles == "") { echo "<h4>Sin Mensaje</h4>"; echo "<a href='javascript:history.back(1);'>Atras</a>"; } /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */ if($send != false) { mail($recipient, $email, $contactname, $telephone, $email, $detalles, $tipo); echo "<h4>Su mensaje ha sido enviado</h4>"; } else { echo "<h4>No se ha realizado el envio de informaciones a $email</h4>"; } /** error handler ** set error reporting level to 0 for live site, 1 for dev */ ini_set("display_errors", 1); ERROR_REPORTING(E_ALL); ?> And my HTML is : <form action="form.php" method="post" class="contact"> <fieldset> <div> <label for="contactname" class="fixedwidth">Nombre y Apellido</label> <input type="text" name="contactname" id="contactname"/> </div> <div> <label for="telephone" class="fixedwidth">Numero de Telefono</label> <input type="text" name="telephone" id="telephone"/> </div> <div> <label for="email" class="fixedwidth">Correo Electronico</label> <input type="text" name="email" id="email"/> </div> <div> <label for="tipo" class="fixedwidth">Tipo de Seguro</label> <select name="tipo" id="tipo"> <option>Rodaje de spots</option> <option>Sesiones de FotografĂ­a</option> <option>Cortometrajes</option> <option>Otros suguros</option> </select> </div> <div> <p>Texto</p> <div class="textarea"> <textarea name="detalles" id="details" cols="30" rows="7"></textarea> </div> <div class="buttonarea"> <input type="submit" value="Envianos la informacion"/> </div> </div> <p>Una vez recibida su consulta nos pondremos en contacto con usted en la mayor brevedad</p> </fieldset> </form> I have been told that it may be best to combine my variables before I call the function but I am really new at this and have no idea how to do that. Please could someone give me a hand with this.
  7. Hi revraz, thank you again for your reply. I am not 100% sure where the message variable would go, I am still very new and finding it difficult. My best guess would be the following: $detalles = $_POST['detalles']; $tipo = $_POST['tipo']; $telephone = $_POST['telephone']; $email = $_POST['email']; $contactname = $_POST['contactname']; $message = $_POST['message']; $message=stripslashes($message); However I thought the text area was covered by the $detalles = $_POST['detalles']; array as that is what i have named it in the sheet?
  8. Hi Revraz, That was a really quick reply. Thank you. Do you mean to change the "mail the form contents" section to this: //mail the form contents mail( "jan_colombini@hotmail.com", "Web site comments", $body, "From: $jan_colombini@hotmail.com\r\n" )
  9. Hi everyone, I have only just started to follow some php tutorials and seem to have hit a brick wall. I am writing some basic php form processing code for a friends website (well actually following a tutorial and adjusting it slightly to fit my needs) and it just doesn't seem to work properly. Here is the html I am using: <form action="form.php" method="post" class="contact"> <fieldset> <div> <label for="contactname" class="fixedwidth">Nombre y Apellido</label> <input type="text" name="contactname" id="contactname"/> </div> <div> <label for="telephone" class="fixedwidth">Numero de Telefono</label> <input type="text" name="telephone" id="telephone"/> </div> <div> <label for="email" class="fixedwidth">Correo Electronico</label> <input type="text" name="email" id="email"/> </div> <div> <label for="tipo" class="fixedwidth">Tipo de Seguro</label> <select name="tipo" id="tipo"> <option>Rodaje de spots</option> <option>Sesiones de FotografĂ­a</option> <option>Cortometrajes</option> <option>Otros suguros</option> </select> </div> <div> <p>Texto</p> <div class="textarea"> <textarea name="detalles" id="details" cols="30" rows="7"></textarea> </div> <div class="buttonarea"> <input type="submit" value="Envianos la informacion"/> </div> and the php: <?php//import form information $detalles = $_POST['detalles']; $tipo = $_POST['tipo']; $telephone = $_POST['telephone']; $email = $_POST['email']; $contactname = $_POST['contactname']; $message=stripslashes($message); /* Simple form validation check to see if an email and message were entered */ //if no message entered and no email entered print an error if (empty($message) && empty($email)){ print "No email address and no message was entered. <br>Please include an email and a message"; } //if no message entered send print an error elseif (empty($message)){ print "No message was entered.<br>Please include a message.<br>"; } //if no email entered send print an error elseif (empty($email)){ print "No email address was entered.<br>Please include your email. <br>"; } //if the form has both an email and a message else { //Thank the user by name if they entered a name if (!empty($name)) { print "<b>Thank you $name.</b><br>"; } print "<p><b>The following message has been sent</b>: <br>$message<br></p><p><b>Comment type(s):</b><br>$screen_ctypes</p>"; $body= $message . ' Comment type(s)' . $ctypes; //mail the form contents mail( "jan_colombini@hotmail.com", "Web site comments", $body, "From: $email\r\n" ); $page = "http://www.elisegur.es/contact.html"; if (!ereg($page, $_SERVER['HTTP_REFERER'])){ echo "Invalid referer"; die; } } ?> It does send the info to my email address but has the following problems (by the way I am sorry to make it more difficult as it is half in Spanish but please be patient I have only been doing this a few days): The information is not always sent at all. On sending the information it shows "the following information has been sent: ...then the message in the box" have I done the following code wrong? if (!empty($name)) { print "<b>Thank you $name.</b><br>"; either way the message in the box never arrives at my email address. In fact the only info that does arrive is the name and email address. I hope someone can help as I am really desperate to get the hang of php and to help my friend with his website but am just finding it so frustrating. I am sorry if this is very basic for you guys but would really appreciate and suggestion and help you can give. Thanks
×
×
  • 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.