khujo56
Members-
Posts
24 -
Joined
-
Last visited
Never
Everything posted by khujo56
-
i fixed there error but now i get this error when i click submit Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/n/r/jnr1975/html/mailer.php:31) in /home/content/j/n/r/jnr1975/html/mailer.php on line 34
-
Hi Guys Need help trying to figure out why it will not redirect to the assigned page. it says that info has been sent to assigned e-mail after the submit button has been pressed, but does not redirect to the page. below is the code. <?php if(isset($_POST['name']) && empty($_POST['name'])) { $error[] = "Post your name"; } if(isset($_POST['email']) && empty($_POST['email'])) { $error[] = "Post your name"; } if(isset($_POST['message']) && empty($_POST['message'])) { $error[] = "Post your name"; } if(is_array($error)) { echo("errors:<br>"); foreach($error as $x => $i) { echo("- ".$i."<br>"); } } else { $to = "email@here.com"; $subject = "subject"; $message = $_POST['message']; $name = $_POST['name']; $from = $_POST['email']; mail($to, $subject, $message, "From: $name<$from>"); echo("<script>alert(\"Thanks!\nE-mail has been sent!\");</script>"); $url = "www.iheartvacation.com."; header("Location: $url"); } ?>
-
ok here is the html for the form <form action="mailer.php" method="post" name="Form1" id="Form1" > <div class="m" style="margin-left:8px; margin-bottom:4px ">Name</div> <input name="name" type="text" id="name" style="width:290px; height:19px; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''" onClick="this.value=''" value=""> <img src="images/spacer.gif" height="4" style="display:block "> <div class="m" style="margin-left:8px; margin-bottom:4px ">E-mail</div> <input name="email" type="text" id="email" style="width:290px; height:19px; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''" onClick="this.value=''" value=""> <img src="images/spacer.gif" height="4" style="display:block "> <div class="m" style="margin-left:8px; margin-bottom:4px ">Message</div> <textarea name="message" id="message" style="width:445px; height:80px; overflow:hidden; font-family:Tahoma, Arial, Helvetica, sans-serif; font-size:10px; color:#848484 " onFocus="this.value=''" onClick="this.value=''"></textarea> <div style="padding-top:8px; margin-right:30px; margin-top:15px " align="right" class="red "><img src="images/kv.jpg" align="absmiddle" style="margin-right:5px "> <a href="#" class="red2 " onclick="javascript:document.Form1.reset();">Reset</a> <img src="images/kv.jpg" align="absmiddle" style="margin-right:5px "> <input type="submit" name="submit" value="Submit"> </div> </form here is the code for the php: <?php if(isset($_POST['name']) && empty($_POST['name'])) { $error[] = "Post your name"; } if(isset($_POST['email']) && empty($_POST['email'])) { $error[] = "Post your e-mail address"; } if(isset($_POST['message']) && empty($_POST['message'])) { $error[] = "Post your comments"; } if(is_array($error)) { echo("errors: "); foreach($error as $x => $i) { echo("- ".$i." "); } } else { $to = "webmaster@iheartvacation.com"; $subject = "subject"; $message = $_POST['message']; $name = $_POST['name']; $from = $_POST['email']; mail($to, $subject, $message, "From: $name<$from>"); echo("<script>alert(\"Thanks!\E-mail has been sent!\");</script>"); } ?> thanks
-
yeah still does not work...it sends the message and does go to the re-direct page but does not tell you that is has been sent
-
so post this on the actual html page instead of the php page?
-
HI i tried that script..when it says that the info has been sent, instead of re-directing to the assigned page, i get this message instead : Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/n/r/jnr1975/html/mailer.php:33) in /home/content/j/n/r/jnr1975/html/mailer.php on line 37
-
that does not work, sorry
-
so how would i change that ???
-
so i finally figured out that i did not have a php package for my hosting. finally switched over to php, it works fine but it does redirect to the assigned address. instead i get this message Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/n/r/jnr1975/html/mailer.php:31) in /home/content/j/n/r/jnr1975/html/mailer.php on line 34....it should redirect to the main page. below is the php script. <?php if(isset($_POST['name']) && empty($_POST['name'])) { $error[] = "Post your name"; } if(isset($_POST['email']) && empty($_POST['email'])) { $error[] = "Post your e-mail address"; } if(isset($_POST['message']) && empty($_POST['message'])) { $error[] = "Post your comments"; } if(is_array($error)) { echo("errors:<br>"); foreach($error as $x => $i) { echo("- ".$i."<br>"); } } else { $to = "webmaster@iheartvacation.com"; $subject = "subject"; $message = $_POST['message']; $name = $_POST['name']; $from = $_POST['email']; mail($to, $subject, $message, "From: $name<$from>"); echo("<script>alert(\"Thanks!\E-mail has been sent!\");</script>"); $url = "http://www.iheartvacation.com/"; header("Location: $url"); } ?>
-
the form works fine but the info does not get to my assigned address...i tried my hotmail account then i switched to my other e-mail address..neither receives any
-
is there an alternative to that. it kinda defeats the purpose of a form if the info cannot be sent to the assigned e-mail address
-
well i tried my actual e-mail address associated with my website and i still don't get anything. what could be the problem??
-
well either one works great..so thank you. now i still did not get the e-mail that i tested. is there a problem with hotmail accounts it should usually be fast.
-
is there a way you can say it has been submitted to my e-mail address then have it re-directed to a new page?
-
thanks that helped. is there a way you can write a message that is has been posted, then have it re-directed to another page..like back to the main page ?
-
can anyone please help me with this..it's so close to working but something is not functioning properly
-
hey, yeah i've tried the new code, still gettting the white page when i click submit. so odd why it does that. could it be the form itself that's messing up..everything looks ok on the form.
-
ok i deleted the script and put echo 'test 101'; and clicked submit, it went to another page with test 101 on it
-
sorry i'm a php newbie..i'm not sure what u mean by that
-
yeah it' still does not work..it's odd
-
Hi Teng Actually i got the code from your prior post. here it is below. here is the page where the form is on. http://www.iheartvacation.com/index-4.html here is the code <?php if(isset($_POST['submit'])) { $to = "jnr1975@hotmail.com"; $subject = "Contact Info"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $errors = ''; if (!isset($name_field)) { $errors .= 'fill out name'; } if (!isset($email_field)) { $errors .= 'fill out email'; } if (!isset($message)) { $errors .= 'fill out message'; } $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; if ( !empty($errors) ) { echo $errors; } else { if(mail($to, $subject, $body) { echo "Data has been submitted to $to!"; } } } ?>
-
Hi i've tried the new script and when i put nothing in the form and click submit, all i get is a blank page. there is no message saying to fill in the form. any idea what's causing this
-
sorry i should have said someone else wrote this script. do i just add what you put
-
Hi guys i created a contact form in html and a code in php to send the info to my e-mail account. the problem i have is that i want an error to show if nothing or some of the info is not filled in when i press the submit button. if i click the submit button with nothing filled out, it says the info has been sent to my e-mail account. can anyone look at my code and see what i'm doing wrong. below is the php code. <?php if(isset($_POST['submit'])) { $to = "jnr1975@hotmail.com"; $subject = "Contact Info"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $errors = ''; if ( empty($name_field) ) $errors .= 'fill out name<br/>'; if ( empty($email_field) ) $errors .= 'fill out email<br/>'; if ( empty($message) ) $errors .= 'fill out message<br/>'; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; if ( !empty($errors) ) { echo $errors; } else { mail($to, $subject, $body); echo "Data has been submitted to $to!"; } ?>