alex1985
Mar 2 2008, 05:17 PM
| | [attachment=1046:request_book.jpg]
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. |
Comment/Reply (w/o sign-up)
t3jem
Mar 2 2008, 07:15 PM
Oh, I actually have a script like that, i'll modify it for your needs and put up shortly CODE <?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 want echo "<select name='tag'><option value='none'>none</option></select>";//add more options, I don't know all the options you want 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']); 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, trap17 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 
Comment/Reply (w/o sign-up)
alex1985
Mar 3 2008, 09:33 AM
Thanks. I really appreciate thus. The forum is great due to the fact that help is always obtained during the participation process. 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.
Comment/Reply (w/o sign-up)
t3jem
Mar 5 2008, 02:43 AM
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. CODE <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 want echo "<select name='tag'><option value='none'>none</option></select>";//add more options, I don't know all the options you want echo "<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."; } }
?>
Comment/Reply (w/o sign-up)
alex1985
Mar 6 2008, 05:07 PM
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?!
Comment/Reply (w/o sign-up)
t3jem
Mar 7 2008, 01:51 AM
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.
Comment/Reply (w/o sign-up)
alex1985
Mar 7 2008, 03:29 PM
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.
Comment/Reply (w/o sign-up)
t3jem
Mar 8 2008, 07:00 AM
Yes, for the html tags you can either do CODE echo "<your tag>" or CODE ?><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.
Comment/Reply (w/o sign-up)
jlhaslip
Mar 8 2008, 09:02 AM
Change these lines : CODE echo "<p><input type='submit' value='Submit'/>"; echo "</form>"; to read as so : CODE echo "<p><input type='submit' value='Submit'/>"; echo "<p><input type='reset' value='Reset'/>"; echo "</form>"; Not tested. Should work fine.
Comment/Reply (w/o sign-up)
alex1985
Mar 8 2008, 11:23 AM
Thanks for reply. I think that has to woke fine, if not - I let you know.
Comment/Reply (w/o sign-up)
Similar Topics
Keywords : php, code, needed, iii
- Gallery Help Needed
errors help help (10)
Php Code For Login Form With Validation In Php
(7) I dont want to use javascript as a validation form i want to use Regular expression in PHP for Login
or other page. please any one have a best code for validation in PHP. as i thinks that web site
Validation on server site is faster then client site validation. Most welcome.....
Create Table - Mysql Code - Help
(1) I need your feedback about setting the database issues. Please, review them and correct some entries
in the code if they got some mistakes. This is the code itself: SQL CREATE TABLE `news` (
`id` int(250) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '',
`text` text NOT NULL, `author` varchar(255) NOT NULL default '', `valid` varchar(255)
NOT NULL default '', `date` varchar(255) NOT NULL default '', PRIMARY KEY
(`id`) ) ENGINE = MyISAM ; ....
Php Source Code Unveiled In Browser?
is that possible? (7) I am quite new to PHP and this concern came to my mind after playing around a bit with it... When
PHP is not correctly configured on the web server the source code of a php file we try to access
through a browser will be shown instead of the result of the code itself. This will normally not
happen when PHP is working properly, but I was just wondering if it could still be possible to see
that code if a user wanted to or if something on the server failed. This would for example expose
sensitive information like mysql passwords and so on... Is anything like that possib....
Malicious Code Injection
(3) Hi everyone! This is my first post, so be kind! Basically, I'm trying to get a free host
together so am writing some posts. Here's a little summin' summin' about malicious code
injection with PHP applications. Basically, this security exploit is one of the oldest tricks in
the books and all comes down to the fact that PHP allows execution of both local and remote scripts
with the SAME function... dur. Anyway, this is how it works. Image you've just employed a young
go getter, straight outta uni, who has found becoming a Jack of all trades a sinch. Y....
Tutorial Needed?!
PHP+Ajax (12) I need many tutorials based on PHP programming language and AJAX technology. Those tutorials might
be of any kind. Please post only the links to the trusted and working tutorials!....
Php And Mysql Programming
anyone knows a code for mysql and php (2) hi everyone! I am making a program using php and mysql...I am a noob on this so i need your help
guys...I want to make a simple program that will some values and then store them on a database and
then retrieve them...uhmm let me give an example out put of what i need. This is the example say..:
Enter First Name: Enter Last Name:
Enter Age: Enter Address: ..those are the
data needed for input values...my question now is how can I make a database whi....
Admin Page
Tutorial Needed? (4) I need to look at a nice tutorial how do you create an admin access page with many functions as many
as possible.....
Tools Needed!
PHP & MySQL (9) Hello, everyone! I need some tools for those two things to test PHP scripts coming together with
database on my laptop, instead checking them on a web-server which takes time.....
Looking For Command Line Based Sql Modification
Program Needed For SQL? (1) How I use Windows command prompt client and do modifications to my SQL database. If yes, please
write the commads I should know for that. If no, please get me the software with which I can do it.
Topic title modified. Proper English is always required when posting in our forum. ....
Php Code?
Mathematical Applications (12) Hello, everyone. The help is needed again. How can I make calculator in PHP language? That will act
like that a user just type in the fields known values, then click the button, and it's going to
be solved automatically. In other words, have can I write a formula in PHP, how to plug it inside
that language. For example, the formula to find a peremeter of square is: P=4a. So, a user
just can write the known value which is peremeter itself and it will find the side of a square; and
vice versa. If you can write many things how to do such formulas, such as comp....
Php Code Needed
Working Together? (5) Hello, everyone. I need your help again. This forum is quite good for it. Well, I need create a
registration form for my web-site using PHP and SQL. The information it should contain: 1) User
Name 2) First Name 3) Last Name 4) Password 5) e-mail Address 6) Security Image: that images helps
to protect a random registration, for instance, 56+2=where user have to type an answer in order to
finish registration. That's all for today. Anymore things, I will post another post over here.
....
Php Code
Needed?! (15) Well, I am a novice in PHP programming, so there is a script which I wanna get: 1. You go the
web-site 2. On the main screen, there is a some kind of field windows, the one you get used to type
in, when you go to google, for instance. 3. He or she types her email address and it's going to
be saved in my SQL database. 4. That's it. Help me if you can.....
Slaed Cms
Book Needed!!! (2) Hello, everyone! I need some tutorial for Slaed Engine for any version you might find. I wanna learn
how you can make modules or blocks for this CMS. Especially, library functions and other things that
will make the web-site works like virtual library.....
Use Rss In Php Code
(3) so, how can I make RSS reader on my website? thanks in advance....
Will This Code Work
php linking script ?p= (5) hi i'm not that great at php so i'm not to sure if this will work or not. but what i want to
do is be able to use ?p=staff or what ever page name, with out the php extion, and i would like to
no if this simple script i made would work. the code is: CODE $p = $_GET ; if ( !empty($p) &&
file_exists('./' . $p . '.php') && stristr( $p, '.' ) == False ) { // pages
= directory where you store your pages $file = './' . $p . '.php'; } else { //
1.php = defult page $file = './index.php'; } include $file; ?> ....
I Need Some Proof Reading For My Code Please! [resolved]
(7) Well... everything is fine except the Content Select section (refer to the in-code headings)...
thats where it says the error is... could anyone find out why it wont work when I click one of my
links? http://2kart.trap17.com/progress.php for an example of what happens...
//----------------- //portfolio paths //----------------- $portfolio = "/portfolio"; $lay =
"/images"; //------------------ //navigation //------------------ $link = · Home html; $link
= · Portfolio html; $link = · Programming html; $link = · Graphics html; $link
= ....
Html Code Tester. Online Script
(15) Yes, yes. I have another script that I have written and I am distributing. I am not entirely sure if
this works. I have not tested it yet, but I will later and post back with a demo and fix it up.
Current script: CODE //Save this as something like htmltest.php function CheckForm() {
$html_unsafe=$_POST ; //Gives us our user input $html_safe=str_replace(" //Starts security measures
$html_safe=str_replace("?>"," ",$html_safe); //User input now secure server side //Still security
issues client side echo $html_safe; //echos our statement } //End function //Main script....
Awesome Source Code Viewer Script
(7) Hello! I have just came up with a sweet script to show the source code of any website and it only
requires one file. This is the basis of the script and can be customized with CSS and other things
and can be instituted as a public resource. Well I will provide the code and a step-by-step tutorial
on each of its parts. This code has been tested by me. Enjoy! CODE //This little tag starts
our php script and is easily the most important part of the script. //We will start our base script
here. //You can change some of the styles used here to your desired color. if (....
Wamp Packages Needed To Test Scripts
Set up Apache, PHP, etc on your machine (1) In order to test php scripts on your localhost machine, you require a system that includes php
parsing. A WAMP set-up 'usually' includes a database server, and a database manager, too.
For Windows machines, theses are usually referred to as WAMP because they include Apache, Mysql, and
PHP for Windows, hence the acronym WAMP. Wikipedia has a listing of the available packages with
details about the included versions and often a link to the wikipedia article describing them. The
list can be found at http://en.wikipedia.org/wiki/Comparison_of_WAMPs Personally, I....
Creatting A Playlist Through Php
script help needed (5) Hi I am trying to make a script so that i can insert songs into a playlist, but i need a script in
which it opens the playlist file and removes the closing tag at the end, so before i can add more
entrys. e.g CODE Location 5 Location 4 Location 3 Location 2 Location 1 But to
add more entrys i would have to get rid of the atx, then use the fputs to place the new entry into
the file. code tags added Topic title modified. ....
Display The Current Date/time
With a simple PHP code (4) Use this code to display the current date and time. CODE $date = date('l dS \of F Y
h:i:s A'); echo "$date"; ?> "l" would display the current day of the week such as
Sunday. d displays the day of the month... such as 1 and S adds the appropriate suffix(st). /of
simply displays the word "of". F displays the current month with no abbreviations while Y displays
the four digit year(2007). "h" displays the current hour with leading zeros if necessary(Ex. 06 for
6 o'clock). "i" displays the minute of the hour with leading zeros if necessary. ....
Wap Source Code Viewer
Mobile/wap source code viewer page (4) This is a source code viewer that will workl on wap/mobile sites but you can easily convert it to
work on web im sure ;-) CODE header("Content-Type: text/vnd.wap.wml"); echo '
'; print " "; if ($url == "") { echo " Enter url: »View source code "; }
if ($url == "$url") { $udata=@file_get_contents("$url"); $udata = str_replace("$","$$",$udata);
$udata = str_replace("&","&",$udata); $udata = str_replace("'","'",$udata); $udata =
str_replace(" $udata = str_replace(">",">",$udata); $udata = str_replace("\"....
Requesting Auto Generating Id Tag In Php Code
Php Coding (3) Hello...I'm designing a website in PHP where ppl can submit their links for "cool sites".
Anyway, when somebody submit's a link to a website for example "http://www.google.com" it
creates an id such as "index.php?id=1134411593". I dont want the links to be converted into
id's. I want it to remain as "http://www.google.com". I have the following coding on
( echo " ). I'm a novice. Please Help!!!! Thanks... Plus I
also want to add the date on when the link was submitted. Please follow our forum rule by making....
Dynamic Image / Signature Generator
a simple code to change text on an image (12) In search of dynamically changing quote, saying or all other types of text on an image I came across
a code that I have modified to fit my initial usage. This procedure requires two files and short
knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
CODE header("Content-type: image/png"); $image = imagecreatefrompng("../i....
Adapting Html Code Embed To Work On Phpnuke
Help With This Html Code Pls (7) QUOTE how can get this html code to work on my phpnuke site? what tags would i
have to enable in the $Allowable HTML part of my config.php file?? Edited topic title. Moved to
Programming. ....
Change Permission With Php Code
code to change files' and folders' permissions? (3) As everyone know, there two ways (that I can think of) to change files' and directories'
permissions. One is to change it in your cPanel's Disk Manager and the other is with an FTP
client that supports chmod. Well, I'm doing something for my site that requires files to have
full permissions (Execute, Write, and Read on all three groups). At first, I thought that if I made
the directory 777, then every file created in that directory will be 777 as well. I'm wrong. An
alternative to doing this is to change each file permission myself, but that would be....
Get Filename Of Referring Url
php code to get filename of referring URL (9) Hey /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> I want to know how
to get the filename of the referring URL. Look at the following example: Page A which has a URL of
http://blah.trap17.com/blah/blah1.php redirects the user to Page B which has a URL of
http://blah.trap17.com/blah/blah2.php . Is there a PHP code that I can put on blah2.php that will
output blah1.php? I tried _SERVER ; (please note the code may not exactly be correct as I do not
remember the code /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' />....
Php Clock
source Code (8) Hi Every one i find this code its very easy simple php clock i think you can use it /blink.gif'
border='0' style='vertical-align:middle' alt='blink.gif' /> CODE // Binary Clock // script
copyright© 2002 Andreas Tscharnuter // questions? contact: psychodad@psychodad.at ||
http://www.psychodad.at/clock/ // free to use, copy and modify but leave comments untouched;) //
just include this file where your binary clock should appear // version 1.2 03 September 2003 //
below you can change different settings // and remember to drink m000re milk! $size = "40"; ....
How do you test your php code
(97) We know that php is a server side scripting language. So we will need a server with the php parser
to parse/test our code. How are you doing that. Do you upload it to a server for testing or did you
instal php and the server (apache) on your computer (localhost)....
Looking for php, code, needed, iii
|
Searching Video's for php, code, needed, iii
See Also,
|
advertisement
|
|