alex1985 0 Report post Posted March 2, 2008 Hello, everyone. I need your help again! Who might create the PHP code, the picture is above this text. Basically, I want when the user fill in all the information in this form, it automatically was sent to my email. And, then, the dialog box appears or on the same window, it was said that your request has been sent. Moreover, if the user did not fill the entire information, the dialog box appears stating that you did not fill some field. Thanks, for help. You always do that. Share this post Link to post Share on other sites
t3jem 0 Report post Posted March 2, 2008 (edited) Oh, I actually have a script like that, i'll modify it for your needs and put up shortly <?php$filename = 'this.php';//name of this file$sendmail = 'yourmail@mail.com';//your email address$frommail = 'from@mail.com';//address the mail wants to be from$a = $_GET['a'];$filename = $filename."?a=1";if($a != 1)//if not yet submitted{echo "<form action=$filename method='post'>";echo "Username<br><input size=32 type='text' name='username' value='guest' /><br>";echo "Password<br><input size=32 type='password' name='password'/><br>";echo "Title<font color='red'> (we will add \"[request_ebook]\" in the title automatically)<br><input size=100 type='text' name='title'/>required</font><br>";echo "Author<br><input size=32 type='text' name='author'/><br>";echo "Language<br><input type='radio' name='language' value='none' checked>None";echo "<input type='radio' name='language' value='english'>English";echo "<input type='radio' name='language' value='chinese'>Chinese";echo "<br>Pages<br><input type='text' size=32 name='pages' />";echo "<br>Publisher<br><input type='text' size=32 name='publisher' />";echo "<br>ISBN<br><input type='text' size=32 name='isbn' />";echo "<br>Release date<br><input type='text' size=32 name='release' />";echo "<br>Small book cover image URL<br><input type='text' size=100 name='smallcover' />";echo "<br>Large book cover image URL<br><input type='text' size=100 name='largecover' />";echo "<br>Catagory/Tag<br>";echo "<select name='category'><option value='ebook'>ebook</option></select>";//add more options, I don't know all the options you wantecho "<select name='tag'><option value='none'>none</option></select>";//add more options, I don't know all the options you wantecho "<p><input type='submit' value='Submit'/>";echo "</form>";}else//otherwise do this{ $email = htmlentities($_POST['email']); $to = "quid3d@hotmail.com"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: '.$frommail. "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $message = 'Username: '.htmlentities($_POST['username']).'<p>Password: '.htmlentities($_POST['password']).'<p>Title: '.htmlentities($_POST['title']).'<p>Author: '.htmlentities($_POST['author']).'<p>Language: '.htmlentities($_POST['language']).'<p>Pages: '.htmlentities($_POST['pages']).'<p>Publisher: '.htmlentities($_POST['publisher']).'<p>ISBN: '.htmlentities($_POST['isbn']).'<p>Release: '.htmlentities($_POST['release']).'<p>Small cover image URL: '.htmlentities($_POST['smallcover']).'<br><img src='.htmlentities($_POST['smallcover']).'><p>Large cover image URL: '.htmlentities($_POST['largecover']).'<br><img src='.htmlentities($_POST['largecover']).'><p>Category: '.htmlentities($_POST['category']).'<p>Tag: '.htmlentities($_POST['tag']); echo $message . '<p>'; if(mail($sendmail,htmlentities($_POST['title']).'[request_ebook]',$message,$headers)) { echo "Your request has been sent."; } else { echo "I'm sorry, there was an error and the request was not sent."; }}?> Alright, that should work, I wasn't able to test it because XAMPP defaults to disabling the mail function; however, Xisto has the mail function enabled if you are using trap for hosting.Just fill in the variables at the top with the values you need.If you have any questions about it feel free to PM me, I won't be checking up on this thread later. Hope this is what you were looking for Edited March 2, 2008 by t3jem (see edit history) Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 3, 2008 Thanks. I really appreciate thus. The forum is great due to the fact that help is always obtained during the participation process.[hr=noshade] [/hr]Thanks for your useful reply. I wanna to make centered, and have some border over those datas. How can I do it? And below, the last column or field, I wanna have an introduction, that the user wrote some intro about the book. So, I need to insert a big field shaped like a big box or square. Share this post Link to post Share on other sites
t3jem 0 Report post Posted March 5, 2008 (edited) Alright, here it is. Hope this works out for you!Again, won't check up on this thread after this post, so let em know if you need anything more. <style type="text/css">input{border: 1px #999999 solid;}textarea{border: 1px #999999 solid;}</style><?php$filename = 'this.php';//name of this file$sendmail = 'yourmail@mail.com';//your email address$frommail = 'from@mail.com';//address the mail wants to be from$a = $_GET['a'];$filename = $filename."?a=1";if($a != 1)//if not yet submitted{echo "<form action=$filename method='post'>";echo "Username<br><input style='strong' size=32 type='text' name='username' value='guest' /><br>";echo "Password<br><input size=32 type='password' name='password'/><br>";echo "Title<font color='red'> (we will add \"[request_ebook]\" in the title automatically)<br><input size=100 type='text' name='title'/>required</font><br>";echo "Author<br><input size=32 type='text' name='author'/><br>";echo "Language<br><input type='radio' name='language' value='none' checked>None";echo "<input type='radio' name='language' value='english'>English";echo "<input type='radio' name='language' value='chinese'>Chinese";echo "<br>Pages<br><input type='text' size=32 name='pages' />";echo "<br>Publisher<br><input type='text' size=32 name='publisher' />";echo "<br>ISBN<br><input type='text' size=32 name='isbn' />";echo "<br>Release date<br><input type='text' size=32 name='release' />";echo "<br>Small book cover image URL<br><input type='text' size=100 name='smallcover' />";echo "<br>Large book cover image URL<br><input type='text' size=100 name='largecover' />";echo "<br>Catagory/Tag<br>";echo "<select name='category'><option value='ebook'>ebook</option></select>";//add more options, I don't know all the options you wantecho "<select name='tag'><option value='none'>none</option></select>";//add more options, I don't know all the options you wantecho "<br>Introduction: <font color='red'>Required! It'll be easier to find books if you give more details.<br><textarea cols=80 rows=50 name='introduction'></textarea>";echo "<p><input type='submit' value='Submit'/>";echo "</form>";}else//otherwise do this{ $email = htmlentities($_POST['email']); $to = "quid3d@hotmail.com"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: '.$frommail. "\r\n"; $headers .= 'X-Mailer: PHP/' . phpversion(); $message = 'Username: '.htmlentities($_POST['username']).'<p>Password: '.htmlentities($_POST['password']).'<p>Title: '.htmlentities($_POST['title']).'<p>Author: '.htmlentities($_POST['author']).'<p>Language: '.htmlentities($_POST['language']).'<p>Pages: '.htmlentities($_POST['pages']).'<p>Publisher: '.htmlentities($_POST['publisher']).'<p>ISBN: '.htmlentities($_POST['isbn']).'<p>Release: '.htmlentities($_POST['release']).'<p>Small cover image URL: '.htmlentities($_POST['smallcover']).'<br><img src='.htmlentities($_POST['smallcover']).'><p>Large cover image URL: '.htmlentities($_POST['largecover']).'<br><img src='.htmlentities($_POST['largecover']).'><p>Category: '.htmlentities($_POST['category']).'<p>Tag: '.htmlentities($_POST['tag']).'<br>Introduction: '.htmlentities($_POST['introduction']); echo $message . '<p>'; if(mail($sendmail,htmlentities($_POST['title']).'[request_ebook]',$message,$headers)) { echo "Your request has been sent."; } else { echo "I'm sorry, there was an error and the request was not sent."; }}?> Edited March 5, 2008 by t3jem (see edit history) Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 6, 2008 Yep, the big box appears, where you can type the introduction but the data in that php file can be centered if I open it online?! Share this post Link to post Share on other sites
t3jem 0 Report post Posted March 7, 2008 Yes, you can make it centered using the <center> tag. I don't know how it would look centered (I don't think it'd be all that pretty), but it will work. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 7, 2008 So, I can use HTML tags and plug it into PHP code, it does work in this way?! Well, I need as well to create a button callled "reset" or "clear" next to submit button. When, you pressed it, the typed information will be erased. Share this post Link to post Share on other sites
t3jem 0 Report post Posted March 8, 2008 Yes, for the html tags you can either do echo "<your tag>" or ?><your tag><?php And for the reset button, I'll get to work on that next week, this weekend I'm completely booked and can't do anything, but roof a house i'm afraid; however, I will be sure to get it to you by Tuesday Morning. Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted March 8, 2008 Change these lines : echo "<p><input type='submit' value='Submit'/>";echo "</form>";to read as so :echo "<p><input type='submit' value='Submit'/>";echo "<p><input type='reset' value='Reset'/>";echo "</form>"; Not tested. Should work fine. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 Thanks for reply. I think that has to woke fine, if not - I let you know. Share this post Link to post Share on other sites
t3jem 0 Report post Posted March 9, 2008 thanks jlhaslip, I didn't really know how to do that part so you saved me a ton of time. Alex, I hope all this works for you, let me know if you need anything else. Share this post Link to post Share on other sites