Jump to content

quarantine

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

quarantine's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a pretty straight forward contact form that should email to the specified email address, but when I fill out the form, and submit, it just takes me to a blank page on contact.php instead of echoing that my message has been sent.... contact.html <html> <head> <title>Contact Form</title></head> <body> <form method="post" action="contact.php"> Name:<input name="fullname" type="text"> <br /><br /> Email:<input name="email" type="text"><br /> <br /> Message: <br /><textarea rows="5" cols="50" name=" message"> Please type your message here! </textarea> <br/> <br/> <input type="submit" value="Submit"> </form> </body> </html> contact.php <?php ini_set('display_errors','On'); // Grabing the info from the contact form $name = $_POST['fullname']; $from = $_POST['email']; $message = $_POST['message']; // Email info and variables $to = "youremail@example.com"; $subject = "Contact Form"; $body = "$message"; $headers = "From: $from" . "X-Mailer: php"; if (mail($to, $subject, $body, $headers)) { echo("<p>Message Sent!</p> <br /> <br /> Click <a href="#"> Here</a> to return to the main page."); } else { echo("<p>Message delivery failed... Please hit back, and try again.</p>"); } ?> Any suggestions? :'( -Thanks
  2. I have come to a bit of a crossroads in my php studies. I have just recently started casually learning little bits of php here and there. I don't consider myself very advanced, I would say I have the basic structure of php under my belt as well as most of the basic loops like foreach(), while(), and some conditional statments like "if..else". My big problem is, I don't know where to take my learning next. I believe I have moved out the complete "101" beginner stage, but I can't seem to find tutorials or resources between absolute beginner and intermediate. If someone could explain which direction I should be heading in php, and show me some great resources online to learn, that would be wonderful!
  3. So lets say I am using a simple mail script like <?php $to = "recipient@example.com"; $subject = "Hi!"; $body = "Whats up??"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed!!!</p>"); } ?> So with this script is will send a message to "recipient@example.com" how can I add more recipients? Like 3 or 4 people? thanks.
  4. you could make a separate page for each store owner and shopper login.
  5. Thanks, that works great, but it is printing all on the same line like...... texttextextextextext I was trying to get it to print line by line like.... text text text text Is there a way to do that?
  6. I am trying to figure out how to print a text file line by line on a HTML page when it loads. This is the basic setup of the page I have ..... <html> <head> <title>Guest Book </title> </head> <body> <form action="guestbook.php" method="post"> Name:<input type="text" name="name" /> <br /> Message:<input type="text" name="body" /> <input type="submit" value="Sign Guest Book" /> </form> <br /> <br /> <?php // set file to read $file = 'guestbook.txt' or die('Could not read file!'); // read file into array $data = file($file) or die('Could not read file!'); // loop through array and print each line foreach ($data as $line) { echo $line; } ?> </body> </html> I tried using foreach() and reading the text file line by line, but when I go to the html page nothing happens. Am I putting this php in the wrong place? How can I best archive this? *EDIT* I would like to text file to appear line by line, instead of printing all on one line.
  7. aww simple mistake thanks for helping me out!
  8. I just started learning php and I am having trouble with this script, I intend for the script to write a users input and name into a text file on my server, when I run the script I can't get it to write anything, and it doesn't give me any errors. Any suggestions? <?php //retrieve user input $_POST['body'] = $body; $_POST['name'] = $name; //open and close the guest book file for writing $guestbook = "guestbook.txt"; $fh = fopen($guestbook, 'a') or die("can't open file"); fwrite($fh, $name, 'says', $body); fclose($fh); ?> Thanks for taking the time to read!
  9. Hello everyone, I am new to this community, I have been learning many different web languages like XHTML, CSS and Java, but my php knowledge is lacking. I was trying to make a simple little input box and submit button, that writes the content of the input box onto a text file. I was just asking for something I could refer to or look at, so I could figure out how this works. I know that I need a php file to write the info to a txt file and redirect after the user hits "submit", but I have no clue what I need to write. -Thanks! I hope I can learn lots from you guys!
×
×
  • 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.