PDA

View Full Version : petition form



ClubTime
12-07-2007, 01:00 PM
Okay, i need a petition like SaveHarryPotter.co.uk, so people sign it and it shows u who signed it, can anyone give a link to 1/

ty.


something i can host on my site if possible ;]

Mentor
12-07-2007, 03:12 PM
Basicly change the text on a bog standard guest book and you have it.

Mr Macro
12-07-2007, 03:20 PM
I can code you one.

Mr Macro
12-07-2007, 03:45 PM
Sorry for the double post, but i made the script.

Run this query.


CREATE TABLE `name` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
) TYPE=MyISAM;
Then save this as addname.php


<?php //Written by James
$name = '$_POST[name]';
mysql_connect("localhost", "USER_NAME", "PASSWORD") or die(mysql_error());
mysql_select_db("DATABASE_NAME") or die(mysql_error());

if(!$_POST[submit]){
echo('
<form method="POST">
Name:<input type="text" size="15" maxlength="50" name="name">
<input type="submit" name="submit" value="Submit">
')
}else{
mysql_query("INSERT INTO names
(name) VALUES('$name) ")
or die(mysql_error());
}
Then save this as viewnames.php


<?php //Written by James

mysql_connect("localhost", "USER_NAME", "PASSWORD") or die(mysql_error());
mysql_select_db("DATABASE_NAME") or die(mysql_error());

$result = mysql_query("SELECT * FROM names")
or die(mysql_error());
$row = mysql_fetch_array($result);
echo(''.$row[name].'<br>');


?>
Completely un-tested should work though.

Want to hide these adverts? Register an account for free!