Jump to content

jc2008

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jc2008's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi im hoping someone here can give me a little advice / guidance Basically im devising an online questionnaire/poll building system. Now what i would like to do is once a questionnaire is completely build i would like to set the questionnaire for specific users to complete. As each user completes the questionnaire i would like them to store the results in the MySQL DB. At the moment i have two tables for the polling / questionnaire element of the system. tbl_questions consists of : qid - Questionnaire ID Number qnumber_1 qnumber_2 qnumber_3... through to qnumber_25 qdesc - Questionnaire Description rid - Links to Response ID in the responses table tbl_responses rid response_desc - Response Description response_1 response_2... through to response_10 Now im assuming i would need to create another table , would i need grab both the Response ID and the Questionnaire ID and then store results? Or would it work differently . In the end i would basically like the administratiors be able to take the results from the questions So for example if 60 out of 100 users answer the following question Do you love chocolate? Yes = 60 no = 40 So this to appear in a table with the results from all the other questions contained within the same questionnaire and also an option so it can be viewed as a chart like the one below: http://chart.apis.google.com/chart?chs=250x100&chd=t:60,40&cht=p3&chl=Yes|No
  2. Many thanks guys i had solved this prior to checking back! but always helps when people are around to help
  3. SHIMMYSHINE could i speak to you over msn if possible?
  4. Hi, Im trying to post the value from the option list as shown in the code below... but it doesnt appear to be posting could someone tell me where im going wrong? Basically want it to take the value of the option from the list and when submitted pass it to qbuild.php Do i need to declare 'opt' and if so how? <?php echo "<form method=\"post\" name=\"questions\" name=\"questions\" action=\"qbuild.php\" >"; echo "<div align=\"left\">"; echo "<p>"; echo "Please select number of questions:"; echo "</p>"; echo "<br/>"; echo "<select name=\"questions\">"; echo "<option name=\"opt\" name=\"opt\" value=\"1\">1</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"2\">2</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"3\">3</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"4\">4</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"5\">5</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"6\">6</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"7\">7</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"8\">8</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"9\">9</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"10\">10</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"11\">11</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"12\">12</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"13\">13</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"14\">14</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"15\">15</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"16\">16</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"17\">17</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"18\">18</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"19\">19</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"20\">20</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"21\">21</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"22\">22</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"23\">23</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"24\">24</option>"; echo "<option name=\"opt\" name=\"opt\" value=\"25\">25</option>"; echo "</select>"; echo "<br />"; echo "<br />"; echo "<br />"; echo "<input name=\"submit\" id=\"submit\" type=\"submit\" value=\"Next >\" />"; echo " </p>"; echo "</div>"; echo "</form>"; ?>
  5. Hi, Im looking to code a multiple choice questionnaire generator for a system im creating. Basically i need to be able to select a number of questions and the enter the different multiple choice options for the question. Im guessing this would have to be made from Javascript just wandering if anyone has anything i could use to perhaps build my code up or knows of any forms of tutorial In essenece the system will allow the user to generate a questionnaire and then this will be available to users to submit their answers to the MySQL DB. Regards,
  6. yeh thats the thing that is really bugging me... . :'(
  7. Any idea why the ID value is not being passed across?
  8. Hi, I tried this and it has helped in a way , and it seems to be unable to carry the 'id' field . It does exist in the MySQL table and works perfectly well when the form collects the editable data. The actual SQL statement is below followed by what it echoed out. - $sql99 = "UPDATE fb_users SET name='$name', surname='$surname', email='$email' WHERE id='$id' LIMIT 1"; Any ideas?
  9. I removed the if (mysql_num_rows($res99) == 1) and changed the POSTS to REQUESTS but still no joy really is bugging me now...... <?php session_start(); include "../global.php"; if($_SESSION['uid']){ $id = $_REQUEST['id']; $username = $_REQUEST['username']; $name = $_REQUEST['name']; $surname = $_REQUEST['surname']; $email = $_REQUEST['email']; $sql99 = "UPDATE fb_users SET name='$name', surname='$surname', email='$email' WHERE `id`='$id' LIMIT 1"; $res99 = mysql_query($sql99) or die(mysql_error()); echo "The user has been edited"; }else { // If it did not run OK. echo "The user could not be edited due to a system error. We apologize for any inconvenience."; } ?> [code] [/code]
  10. Still wont work , i am now posting the 'id' aswell as you can see here... <?php session_start(); include "../global.php"; ?> <html> <head> <title>FEEDBK | Edit User</title> <link rel="stylesheet" type="text/css" href="../style.css"> <script language="Javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to logout?"); if(agree){ return true; }else { return false; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if ($_SESSION['uid']) { $sql = "SELECT * FROM `fb_users` WHERE `id`='" . $_SESSION[uid] . "'"; $res = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($res) == 0) { session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } else { $row = mysql_fetch_assoc($res); echo "Welcome back, <a href=\"./index.php?=act=profile&id=" . $row['id'] . "\">" . $row['username'] . "</a>! <a href=\"./logout.php\" onClick=\"return confirmLogout()\">| Logout</a>\n"; //Checks Administrator Status echo "<br>\n"; echo "<a href=\"./index.php\">Forum Index</a>\n"; if ($row['admin'] == '1') { echo " | <a href=\"../admin.php\">Administrative Section</a>\n"; } } } else { echo "Please <a href=\"../login.php\">Login</a> to your account, or <a href=\"../register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if ($_SESSION['uid']) { $sql3 = "SELECT admin FROM `fb_users` WHERE `id`='" . $_SESSION['uid'] . "'"; $res3 = mysql_query($sql3) or die(mysql_error()); if (mysql_num_rows($res) == 0) { echo "You are not correctly logged in\n"; } else { $row2 = mysql_fetch_assoc($res3); if ($row2['admin'] != 1) { echo "You are not permitted to this area!\n"; } else { $act = $_GET['act']; $acts = array('create_cat', 'create_subcat', 'edit_forum_cats', 'edit_forum_subcat', 'manage_users'); $actions = array('create_cat' => 'Create Forum Category', 'create_subcat' => 'Create Forum Sub Category', 'edit_forum_cats' => 'Edit Forum Category', 'edit_forum_subcat' => 'Edit Forum Sub Category', 'manage_users' => 'Manage Users'); $x = 1; $c = count($actions); foreach ($actions as $url => $link) { $bull = ($x == $c) ? "" : " • "; echo "<a href=\"../admin.php?act=" . $url . "\">" . $link . "</a>" . $bull . "\n"; $x++; } if($_SESSION['uid']){ $id = $_GET['id']; $sql20 = "SELECT id, username, name, surname, email, password, admin FROM fb_users WHERE id=$id"; $res20 = mysql_query($sql20) or die(mysql_error()); while ($row = mysql_fetch_array($res20)) { if (mysql_num_rows($res20) == 1) { echo "<form method=\"post\" action=\"update_user.php\" id=\"user_update\" name=\"user_update\">"; echo "<p>"; echo "<label for=\"id\">ID:</label><input type=\"text\" disabled=\"disabled\" name=\"id\" id=\"id\" value=" . $row['id'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"username\">Username:</label><input type=\"text\" disabled=\"disabled\" name=\"username\" id=\"username\" value=" . $row['username'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"name\">First Name:</label><input type=\"text\" name=\"name\" id=\"name\" value=" . $row['name'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"surname\">Surname:</label><input type=\"text\" name=\"surname\" id=\"surname\" value=" . $row['surname'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"email\">E-mail:</label><input type=\"text\" name=\"email\" id=\"email\" value=" . $row['email'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"password\">Password:</label><input type=\"password\" name=\"password\" id=\"password\" onKeyUp=\"passwordStrength(this.value)\" value=" . $row['password'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"passconf\">Confirm Password:</label><input type=\"password\" name=\"passconf\" id=\"passconf\" value=" . $row['password'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"passwordStrength\">Password Strength</label>"; echo "<div id=\"passwordDescription\">Password not entered</div>"; echo "<div id=\"passwordStrength\" class=\"strength0\"></div>"; echo "</p>"; echo "<p>"; echo "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Update\">\n"; echo "</p>"; echo "</form>"; } } } } } } ?> </div> </div> </center> </body> </html> and have adjusted the SQL statement so theres no concat <?php session_start(); include "../global.php"; if($_SESSION['uid']){ $id = $_POST['id']; $username = $_POST['username']; $name = $_POST['name']; $surname = $_POST['surname']; $email = $_POST['email']; $sql99 = "UPDATE fb_users SET name='$name', surname='$surname', email='$email' WHERE `id`='$id' LIMIT 1"; $res99 = mysql_query($sql99) or die(mysql_error()); if (mysql_num_rows($res99) == 1) { echo "The user has been edited"; }else { // If it did not run OK. echo "The user could not be edited due to a system error. We apologize for any inconvenience."; } } ?> It runs straight through no errors are reported and just echo's the user has been edited, however when i check back the user credentials are still the same.
  11. All, Im currently in the process of building a forum, now i have my administrative section which is all good, however im having masses of difficulty updating my users information. I manage to open my page called, edit_user.php which displays all of the selected users information , however when i submit the new data to update_user.php it never updates... but echos "The user has been edited" If you could help i would be grateful been stuck on this for hours now edit_user.php <?php session_start(); include "../global.php"; ?> <html> <head> <title>FEEDBK | Edit User</title> <link rel="stylesheet" type="text/css" href="../style.css"> <script language="Javascript"> function confirmLogout(){ var agree = confirm("Are you sure you wish to logout?"); if(agree){ return true; }else { return false; } } </script> </head> <body> <center> <div id="holder"> <div id="userInfo"> <?php if ($_SESSION['uid']) { $sql = "SELECT * FROM `fb_users` WHERE `id`='" . $_SESSION[uid] . "'"; $res = mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($res) == 0) { session_destroy(); echo "Please <a href=\"./login.php\">Login</a> to your account, or <a href=\"./register.php\">Register</a> a new account!\n"; } else { $row = mysql_fetch_assoc($res); echo "Welcome back, <a href=\"./index.php?=act=profile&id=" . $row['id'] . "\">" . $row['username'] . "</a>! <a href=\"./logout.php\" onClick=\"return confirmLogout()\">| Logout</a>\n"; //Checks Administrator Status echo "<br>\n"; echo "<a href=\"./index.php\">Forum Index</a>\n"; if ($row['admin'] == '1') { echo " | <a href=\"../admin.php\">Administrative Section</a>\n"; } } } else { echo "Please <a href=\"../login.php\">Login</a> to your account, or <a href=\"../register.php\">Register</a> a new account!\n"; } ?> </div> <div id="content"> <?php if ($_SESSION['uid']) { $sql3 = "SELECT admin FROM `fb_users` WHERE `id`='" . $_SESSION['uid'] . "'"; $res3 = mysql_query($sql3) or die(mysql_error()); if (mysql_num_rows($res) == 0) { echo "You are not correctly logged in\n"; } else { $row2 = mysql_fetch_assoc($res3); if ($row2['admin'] != 1) { echo "You are not permitted to this area!\n"; } else { $act = $_GET['act']; $acts = array('create_cat', 'create_subcat', 'edit_forum_cats', 'edit_forum_subcat', 'manage_users'); $actions = array('create_cat' => 'Create Forum Category', 'create_subcat' => 'Create Forum Sub Category', 'edit_forum_cats' => 'Edit Forum Category', 'edit_forum_subcat' => 'Edit Forum Sub Category', 'manage_users' => 'Manage Users'); $x = 1; $c = count($actions); foreach ($actions as $url => $link) { $bull = ($x == $c) ? "" : " • "; echo "<a href=\"../admin.php?act=" . $url . "\">" . $link . "</a>" . $bull . "\n"; $x++; } if($_SESSION['uid']){ $id = $_GET['id']; $sql20 = "SELECT username, name, surname, email, password, admin FROM fb_users WHERE id=$id"; $res20 = mysql_query($sql20) or die(mysql_error()); while ($row = mysql_fetch_array($res20)) { if (mysql_num_rows($res20) == 1) { echo "<form method=\"post\" action=\"update_user.php\" id=\"user_update\" name=\"user_update\">"; echo "<p>"; echo "<label for=\"username\">Username:</label><input type=\"text\" disabled=\"disabled\" name=\"username\" id=\"username\" value=" . $row['username'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"name\">First Name:</label><input type=\"text\" name=\"name\" id=\"name\" value=" . $row['name'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"surname\">Surname:</label><input type=\"text\" name=\"surname\" id=\"surname\" value=" . $row['surname'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"email\">E-mail:</label><input type=\"text\" name=\"email\" id=\"email\" value=" . $row['email'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"password\">Password:</label><input type=\"password\" name=\"password\" id=\"password\" onKeyUp=\"passwordStrength(this.value)\" value=" . $row['password'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"passconf\">Confirm Password:</label><input type=\"password\" name=\"passconf\" id=\"passconf\" value=" . $row['password'] . ">"; echo "</p>"; echo "<p>"; echo "<label for=\"passwordStrength\">Password Strength</label>"; echo "<div id=\"passwordDescription\">Password not entered</div>"; echo "<div id=\"passwordStrength\" class=\"strength0\"></div>"; echo "</p>"; echo "<p>"; echo "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Update\">\n"; echo "</p>"; echo "</form>"; } } } } } } ?> </div> </div> </center> </body> </html> update_user <?php session_start(); include "../global.php"; include_once "../functions.php"; connect(); if($_SESSION['uid']){ $id = $_POST['id']; $username = $_POST['username']; $name = $_POST['name']; $surname = $_POST['surname']; $email = $_POST['email']; // $sql = "UPDATE fb_users SET `name` = ".$name.", `surname` = ".$surname.", `email` = ".$email.", `password` = ".$password." WHERE `id`='$id' LIMIT 1"; $sql99 = "UPDATE fb_users SET name='$name', surname='$surname', email='$email' WHERE `id`='".$id."' LIMIT 1"; $res99 = mysql_query($sql99) or die(mysql_error()); //if (mysql_num_rows($res) == 1) { echo "The user has been edited"; }else { // If it did not run OK. echo "The user could not be edited due to a system error. We apologize for any inconvenience."; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.