•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 361,626 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,224 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1914 | Replies: 62 | Solved
![]() |
•
•
Join Date: Dec 2007
Posts: 59
Reputation:
Rep Power: 1
Solved Threads: 0
Hey Sorry to bug you guys again. I had one more question. As i am developing this program now i realize that i have no clue how to save the data to the database.
basically the whole point in making this program was to be able to export a table in my database that would store all the submitted data from the survey.
I will have like 30 questions and almost 400 grads. all that data needs to be recorded.
What is going to be the easiest table structure to do that type of thing?
Or is e-mail just going to end up being easier?
basically the whole point in making this program was to be able to export a table in my database that would store all the submitted data from the survey.
I will have like 30 questions and almost 400 grads. all that data needs to be recorded.
What is going to be the easiest table structure to do that type of thing?
Or is e-mail just going to end up being easier?
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,861
Reputation:
Rep Power: 7
Solved Threads: 205
php Syntax (Toggle Plain Text)
CREATE TABLE test ( id INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , name VARCHAR( 100 ) NOT NULL , address VARCHAR( 100 ) NOT NULL ) ENGINE = InnoDB
php Syntax (Toggle Plain Text)
<?php if(isset($_POST['submit'])){ $conn=mysql_connect("localhost","root"); mysql_select_db("exact"); $name=$_POST['name']; $address=$_POST['address']; $query="INSERT INTO TEST (ID,NAME,ADDRESS) VALUES ('','$name','$address')"; mysql_query($query); } ?> <html> <body> <form method="post" action="insert_example.php"> Enter Name: <input type="text" name="name"><br /> Enter Address: <textarea rows="10" cols="20" name="address"></textarea> <br /> <input type="submit" name="submit" value="submit"> </form> </body> </html>
Cheers,
Nav
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Dec 2007
Posts: 59
Reputation:
Rep Power: 1
Solved Threads: 0
so if i wanted to send all the results via e-mail i would do something similar? i am going to search on that site you gave me and that book lets see if i can get it....
I found out how to mail it i just need some help with the security now.
I want to stop people from just going to the page vote.php, i want them going through the login how is that done?
I found out how to mail it i just need some help with the security now.
I want to stop people from just going to the page vote.php, i want them going through the login how is that done?
Last edited by dani190 : Jan 14th, 2008 at 1:35 pm.
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,861
Reputation:
Rep Power: 7
Solved Threads: 205
You can use mail function.
Eg.
Eg.
mail("to address","subject","message contents","from: from address"); Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,861
Reputation:
Rep Power: 7
Solved Threads: 205
Well, you can have a condition to check if the submit button was pressed.
you can send all the data in the message part of the mail.
php Syntax (Toggle Plain Text)
if(isset($_POST['submit'])){ $message="This is the body of this mail. blah blah blah..........some more text... "; mail("test@gmail.com","test mail",$message,"from: someone@gmail.com"); }
Last edited by nav33n : Jan 14th, 2008 at 1:58 pm.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,861
Reputation:
Rep Power: 7
Solved Threads: 205
Yep. Get all the form information, align it as you want. Put it in the 'message' part of the mail.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Dec 2007
Posts: 59
Reputation:
Rep Power: 1
Solved Threads: 0
k so 1 more thing
In the email part i dont know how to retrieve the persons answers from the folllowing...
...
Thanks, Dani
In the email part i dont know how to retrieve the persons answers from the folllowing...
<label>40. Funniest</label><br /> <select name="funniest"> <option value="">Please Choose One Person</option> <option value="">Not Voting</option> <?php echo $option; ?> </select> <br />
...
Thanks, Dani
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 2,861
Reputation:
Rep Power: 7
Solved Threads: 205
On submitting the page, if the user has selected a value from the select box, it will be in $_POST['funniest']. So, you can do something like $x=$_POST['funniest']. $x will have his selection.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
bcsd bcsm blog blogging ccie certification cheating cisco cissp community competition comptia crime daniweb database defender design desktop gentoo google hacker home ipod linux magazine microsoft navigation networks news opinion php red hat research rhce salary school security social spam spyware sql survey teleworking theft virtual vista web windows work
Other Threads in the PHP Forum
- Previous Thread: My sql image links in table
- Next Thread: parse error, unexpected '<' in /data/www/tppine/camo/data/data.php



Linear Mode