eharpaz Posted April 8, 2010 Share Posted April 8, 2010 Soooooo! I'm back again with another awesome question for you guys! My goal is to almost mimic this sites question box http://www.yesdebtfree.com/ (lucky them a free link on this page!) So I tried viewing the source on the page and got this so far: <form name="qForm" id="qForm" method="post" action="http://www.gkicredit.com/FAQ.php"> <div class="ask_quesCont flLt"> <div class="clearAll spacer5"></div> <div class="mlr8"> <h2 style="color: #ce6603; margin: 0; padding: 0; font-weight: normal; font-size: 18px;">Ask your Question</h2> <div class="clearAll"></div> <textarea name="question" id="question" rows="5" cols="5" style="width: 322px; margin: 0; padding: 0; text-align: left; height: 45px; overflow: hidden; font-family: Arial; font-size: 12px; float: left;border:solid 1px #7f9db9;" ></textarea> <div class="clearAll spacer5"></div> <div class="flLt" style="width: 200px;"> <span class="note flLt">Can't find you answer by searching?</span> <div class="clearAll"></div> <div id="qmsg" style="color: #FF0000; font-size: 11px; text-align: center; float: left;"> </div> </div> <span class="flRt"> <input type="image" name="askquestion" title="Ask now" src="http://www.yesdebtfree.com/images/askNow-btn-blue.gif" alt="Ask now" onclick="return SubAns();" style="border-width:0px;" /> Currently that code is just the box to fill in the question, as well as the "Ask now" button which when clicked, bring me to the correct webpage (www.gkicredit.com/FAQ.php is my site which i switched out yesdebtfree site with). Now I'm trying to figure out how they made these questions posted in almost a forum-like fashion which people can click to answer the question. I hope I am not asking too much, any help is GREATLY appreciated Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/ Share on other sites More sharing options...
Jax2 Posted April 8, 2010 Share Posted April 8, 2010 Without writing out the code, I can tell you how they do it ... The questions are asked on the form, which posts the data to the page that processes the form. This page stores the question in a database. They then recall all questions in the database on the new page, using a while loop and repeating the same code for each question, along with pagination. When someone clicks on answers, it just adds their answer to either the same database table (or maybe a different table) and links them together by a common variable such as questionID ... it's all pretty simple... you just need to be pretty good at designing the website and laying it all out, the database stuff is kids play compared to that Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/#findComment-1038770 Share on other sites More sharing options...
oni-kun Posted April 8, 2010 Share Posted April 8, 2010 Would it help if I answered in this colour? Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/#findComment-1038777 Share on other sites More sharing options...
Jax2 Posted April 8, 2010 Share Posted April 8, 2010 Would it help if I answered in this colour? No, not really :D Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/#findComment-1038779 Share on other sites More sharing options...
eharpaz Posted April 8, 2010 Author Share Posted April 8, 2010 Without writing out the code, I can tell you how they do it ... The questions are asked on the form, which posts the data to the page that processes the form. This page stores the question in a database. They then recall all questions in the database on the new page, using a while loop and repeating the same code for each question, along with pagination. When someone clicks on answers, it just adds their answer to either the same database table (or maybe a different table) and links them together by a common variable such as questionID ... it's all pretty simple... you just need to be pretty good at designing the website and laying it all out, the database stuff is kids play compared to that Thanks for the mini summary! But what may be simple to you is another world to me!! D: I would still like to make this code on my site. Could you fill me in with some steps of what is needed in order to make the "database table" where the questions are submitted? Point me in the right direction! Thanks again!! Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/#findComment-1038875 Share on other sites More sharing options...
oni-kun Posted April 8, 2010 Share Posted April 8, 2010 Why not look at the various MySQL tutorials out there? We're not going to show you how to make everything come together, It's beyond what should be in a forum topic. Do you know how to set up a database? http://www.peergoal.com/tutorials/sql-setup/ Do you know any basic SQL commands? Here is a great place to learn. http://www.tizag.com/sqlTutorial/ And then you simply create the database. $con = mysql_connect("localhost","name","abc123pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } if (mysql_query("CREATE DATABASE questions",$con)) { echo "Database created"; } else { echo "Error creating database: " . mysql_error(); } mysql_close($con); And then use a database manager to add an autoincrementing ID and then question column from there. Well, It's 2:30am and I'm tired, let someone else complete the work. And stop abusing the colour feature :-\ Quote Link to comment https://forums.phpfreaks.com/topic/197961-questionanswer-box/#findComment-1038879 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.