need some html/php/java help
•
19 Aug 2011, 12:08
•
Journals
Hi, I bought some .html template and edited it so it fits my needs (some kind of free hosting/bnc/etc service but also selling some things). But I need help with some simple things.
e.g. i have a "enter mail here for newsletter" but the button has no function yet.
also I have been working on some paypal buying & shopping card thingy but I cant get it working properly / fitting it to the html layout / let it look "professional".
the share with facebook/twitter/.. button has no function as well.
i did similar things already on my current layout (so it shouldn't be a hard task) but it looks shit and i want it to look nice :)
thought about using wordpress or some other php software but i have my reasons for not using it.
can offer bnc/webspace/mail account/forwarder and soon ts/vent/vpn/gameserver
qry beAsty @irc
thx bb
e.g. i have a "enter mail here for newsletter" but the button has no function yet.
also I have been working on some paypal buying & shopping card thingy but I cant get it working properly / fitting it to the html layout / let it look "professional".
the share with facebook/twitter/.. button has no function as well.
i did similar things already on my current layout (so it shouldn't be a hard task) but it looks shit and i want it to look nice :)
thought about using wordpress or some other php software but i have my reasons for not using it.
can offer bnc/webspace/mail account/forwarder and soon ts/vent/vpn/gameserver
qry beAsty @irc
thx bb
Also PHP and MySQL.
CREATE TABLE `mydb`.`newsletters` (
`ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`email` VARCHAR( 225 ) NOT NULL
) ENGINE = MYISAM ;
<!DOCTYPE html>
<html lang="en"
<head>
<style type="text/css">
#newsletter{
padding:15px;
background-color: #E4E4E4;
border:1px solid #CCC;
width:280px;
}
#newsletter h2{
margin:0;
padding-bottom:3px;
font-size:19px;
color:#039;
}</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Php Newsletter</title>
</head>
<body>
<?php
$host = "localhost";
$username = "myuser";
$password = "mypass";
$database = "mydb";
$connect = @mysql_connect($host, $username, $password) or die (@mysql_error());
$selectdb = @mysql_select_db($database, $connect) or die (@mysql_error());
if(isset($_POST['submit'])){
$email = $_POST['email'];
if(empty($email)){
echo "you must write your email!";
}else{
@mysql_query("INSERT INTO newsletter SET email='$email'");
echo "Thanks, for subscribing to our newsletter";
}
}
?>
<div id="newsletter">
<h2>Our Newsletter</h2>
subscribe to our newsletter to receive daily articles and update through email!
<form method="post" name="newsletter">
<strong>Email:</strong> <input name="email" type="text" />
<input name="submit" type="submit" value="Subscribe" />
</form>
</div>
</body>
</html>
admin
<!DOCTYPE htm">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sending Newsletter</title>
</head>
<body>
<?php
$host = "localhost";
$username = "myuser";
$password = "mypass";
$database = "mydb";
$connect = @mysql_connect($host, $username, $password) or die (@mysql_error());
$selectdb = @mysql_select_db($database, $connect) or die (@mysql_error());
if(isset($_POST['send'])){
$message = $_POST['newsletter'];
$subject = "Daily Newsletter";
$From = "UrPhp.com Newsletter <[email protected]>";
$emails = @mysql_query("SELECT * FROM newsletter");
while ($show = @mysql_fetch_array($emails)) {
@mail("$show[email]","$subject",$message,"From: $From");
}
echo"<h3>Newsletter has been Sent!</h3>";
}
?>
<h2>Send Newsletters</h2>
<form action="" method="post" name="newsletter">
<strong>Write Newsletter below:</strong><br />
<textarea name="newsletter" cols="70" rows="25"></textarea><br />
<input type="submit" name="send" id="send" value="Send Newsletter" />
</form>
</body>
</html>
I borrowed it somewhere,but I cant find the link,because this code was in code folder,so whoever made it gg.
i can create the mysql db, configure the .php file but no idea how to "link" it with the input field & button :S
I.e. the bit behind the page.
http://www.w3schools.com/php/php_forms.asp should help.
I have only worked briefly with php and everything I know is self taught, so some of it is probably not the correct way to do things, but for a simple DB insertion that website will help you.
Apologies if this is not what you mean.
Use that anywhere and you'll end up with leaking your entire database.