Mamo Posted April 15, 2013 Share Posted April 15, 2013 Hi is there a simple code for asking and answering a question, cause i don't know much about PHP or MySQL . can any one please help me . thanks Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/ Share on other sites More sharing options...
lemmin Posted April 15, 2013 Share Posted April 15, 2013 What kind of question? Multiple choice? Feedback text? Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424922 Share on other sites More sharing options...
Mamo Posted April 15, 2013 Author Share Posted April 15, 2013 question like what i am asking here?...........Technical and coding question. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424927 Share on other sites More sharing options...
lemmin Posted April 15, 2013 Share Posted April 15, 2013 Ok. Where will the answer go? Into a database? Emailed to someone? Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424930 Share on other sites More sharing options...
Mamo Posted April 15, 2013 Author Share Posted April 15, 2013 to database. I am using a local server (WAMP) , and phpMyAdmin. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424933 Share on other sites More sharing options...
godleydesign Posted April 15, 2013 Share Posted April 15, 2013 Not really sure we understand what you mean? What do you mean asking a question and getting an answer? Are you referring to a security to validate if a customer is a real person? Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424934 Share on other sites More sharing options...
Mamo Posted April 15, 2013 Author Share Posted April 15, 2013 what i meant is to ask question, and then any other user can answer (replay) my question. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424937 Share on other sites More sharing options...
lemmin Posted April 15, 2013 Share Posted April 15, 2013 It sounds like you just want a generic feedback-type form. Here is some simply code that would push the input of a textarea into your database: <form method="post"> Question:<br/> <textarea name="answer"></textarea> <input type="submit"/> </form> <?php if (isset($_POST['answer'])) //Form was submitted { mysql_connect('localhost', 'user', 'pass'); mysql_select_db('database'); mysql_query('INSERT INTO tablename VALUES ("'.$_POST['answer'].'")'); } ?> That is very generic and obviously needs to be adjusted for your scenario. Is this the sort of form you are looking for? Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424939 Share on other sites More sharing options...
Mamo Posted April 15, 2013 Author Share Posted April 15, 2013 It sounds like you just want a generic feedback-type form. Here is some simply code that would push the input of a textarea into your database: <form method="post"> Question:<br/> <textarea name="answer"></textarea> <input type="submit"/> </form> <?php if (isset($_POST['answer'])) //Form was submitted { mysql_connect('localhost', 'user', 'pass'); mysql_select_db('database'); mysql_query('INSERT INTO tablename VALUES ("'.$_POST['answer'].'")'); } ?> That is very generic and obviously needs to be adjusted for your scenario. Is this the sort of form you are looking for? Thank you, i understood that, but i need other users on the website to be able to answer the question that i saved . Like the concept of "phpfreaks" website. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424940 Share on other sites More sharing options...
Jessica Posted April 15, 2013 Share Posted April 15, 2013 No, it's not simple. You could use one of the many free or paid forum software out there. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424950 Share on other sites More sharing options...
lemmin Posted April 15, 2013 Share Posted April 15, 2013 I agree with Jessica; the easiest (and incidentally best) solution would be to use a forum solution like Wordpress or Drupal. Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1424956 Share on other sites More sharing options...
Mamo Posted April 16, 2013 Author Share Posted April 16, 2013 I agree with Jessica; the easiest (and incidentally best) solution would be to use a forum solution like Wordpress or Drupal. Thank you Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1425211 Share on other sites More sharing options...
Mamo Posted April 16, 2013 Author Share Posted April 16, 2013 No, it's not simple. You could use one of the many free or paid forum software out there. Thank you Link to comment https://forums.phpfreaks.com/topic/276988-ask-question/#findComment-1425212 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.