|
 |
|
|
09-07-2006, 05:02 AM
|
Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
Hi people
I am designing the website for Nanyang Technological University's Model United Nations Programme and I have a small problem in front of me.
We have to create an online registration system wherin a team could submit their particulars . I want it to be added to a database so that it could be conveniently converted to an excel spreadsheet quickly and without much labour. Can anyone please offer good solutions to this problem
Thanks in advance
Sparsh
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-07-2006, 07:42 AM
|
Re: Help needed
|
Posts: 246
|
How about PHP and MySQL?
To capture the data, a simple HTML form would work. Something like this:
Code:
<form method="post" action="savedata.php">
First Particular:<input type="text" name="particular1">
Second Particular:<input type="text" name="particular2">
<input type="submit" name="submitbutton" value="Submit Particulars">
</form>
To save the data to a MySQL table, make a page called savedata.php that looks something like this:
Code:
<?
mysql_connect("db_host","db_user","db_pass"));
mysql_select_db("db_name");
sql = "insert into table_name (particular1, particular2) values ('".$_POST["particular1"]."','".$_POST["particular2"]."')";
mysql_query($sql);
?>
To export the data to Excel, you can use the following: PHP Help: Exporting MySQL To Excel
|
|
|
|
09-07-2006, 08:55 AM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
Thanks a lot dude... you really made my day... wont forget to thank you on the website if this works out...
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-07-2006, 08:56 AM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
just one more thing.. in addition to adding the data to the mysql can the form also send a copy of the submission to some email address...
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-07-2006, 09:39 AM
|
Re: Help needed
|
Posts: 246
|
Naturally.
Code:
<?
mail("youremail@yourdomain.com", "The Subject", "The Body");
?>
|
|
|
|
09-08-2006, 02:30 PM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
I am using the page http://ntudebsoc.org/Registration.html
and the php code of savedata.php is
Quote:
<?php
include 'config.php';
$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = ("INSERT INTO `ntu_deb_society` VALUES ('$name','$email','$p1','$p2','$contact',)");
mysql_query($query) or die('Error, insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');
?>
|
Everytime i am getting the error Error, insert query failed
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-08-2006, 02:44 PM
|
Re: Help needed
|
Posts: 246
|
You probably need to get rid of the comma after '$contact'
|
|
|
|
09-08-2006, 02:46 PM
|
Re: Help needed
|
Posts: 246
|
And possibly you need to put the field names in the sql query:
Code:
$query = ("INSERT INTO `ntu_deb_society` (fieldname1,fieldname2,fieldname3,fieldname4,fieldname5) VALUES ('$name','$email','$p1','$p2','$contact')");
|
|
|
|
09-08-2006, 03:01 PM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
same error again
here is the corrected code
Quote:
<?php
include 'config.php';
$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = ("INSERT INTO `ntu_deb_society` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2','$contact')");
mysql_query($query) or die('Error, insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');
?>
|
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-08-2006, 03:05 PM
|
Re: Help needed
|
Posts: 246
|
You don't necessarily need the parentheses () around the string when you assign $query.
|
|
|
|
09-08-2006, 03:08 PM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
failed again..
code is
Quote:
<?php
include 'config.php';
$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = "INSERT INTO `ntu_deb_society` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2','$contact')";
mysql_query($query) or die('Error, insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');
?>
|
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-08-2006, 03:28 PM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
oh .. i was mentioning the name of the table wrong... dumb error
the final code
Quote:
<?php
include 'config.php';
$team=$_POST['Team'];
$email=$_POST['Email'];
$p1=$_POST['P1'];
$p2=$_POST['P2'];
$contact=$_POST['Contact'];
$query = "INSERT INTO `Team Name` (Team,Email,P1,P2,Contact) VALUES ('$team','$email','$p1','$p2',$contact)";
mysql_query($query) or die($query);
?>
|
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
09-08-2006, 03:29 PM
|
Re: Help needed
|
Posts: 178
Name: Sparsh
Location: India
|
and ya the Flush Privileges was giving an error so i removed it.. works fine
Special thanks to the coupon guy for all his valuable help 
__________________
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
We are what we repeatedly do... EXCELLENCE ... then is not a fact but a habit.
|
|
|
|
|
« Reply to Help needed
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|