Jump to content

maddcow26

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

maddcow26's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I saw a terrible site once and checked source to see where it all went wrong. The code was an absolute mess, but scattered throughout were apologies like <!-- oh man, I'm sorry. I'm not sure what to do with this part--> <!-- omfg I lost track of which table was in the other one. I'm new to this--> I loved the fact that the person making the page felt bad and took the time to write notes to anyone who checked his source.
  2. Jeez... efficacious is making me all excited. My gf just had to point out that no matter how cool it sounds, trying to explain it all to her just makes me sound like a nerd.
  3. thanks, but same error shows up
  4. I tried (emphasis on TRIED) to make a real simple script to display all info in a db. Below is the code: <? php require_once ('2008formincludes/mysql_connect.php'); $query="SELECT * FROM formresults"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; $i=0; while ($i < $num) { $qname=mysql_result($result,$i,"qname"); $qemail=mysql_result($result,$i,"qemail"); $qaddress=mysql_result($result,$i,"qaddress"); $burlap=mysql_result($result,$i,"burlap"); $gender=mysql_result($result,$i,"gender"); $primarystyle=mysql_result($result,$i,"primarystyle"); $yearsprimary=mysql_result($result,$i,"yearsprimary"); $yearsgrappling=mysql_result($result,$i,"yearsgrappling"); $weekly=mysql_result($result,$i,"weekly"); $stephanquestion=mysql_result($result,$i,"stephanquestion"); $visitorsince=mysql_result($result,$i,"visitorsince"); $$dvdpurchase=mysql_result($result,$i,"dvdpurchase"); echo "<b>Name:$qname</b><br>Email: $qemail<br>Age: $burlap<br>Gender: $gender<br>Primarystyle: $primarystyle<br><hr><br>"; $i++; } ?> When attempting to access the page I get the following error: Parse error: syntax error, unexpected T_REQUIRE_ONCE in /home/jgrapple/public_html/2008results.php on line 3 Any ideas? as best I can tell, my syntax is all correct and I can't see any reason why line 3 is a problem, i just want to connect to my db before running the query... what am I missing?
  5. This is my insert : $query = "INSERT INTO formresults (qname, qemail, qaddress, burlap, gender, primarystyle, yearsprimary, yearsgrappling, weekly, stephanquestion, visitorsince, dvdpurchase) VALUES ('qname', 'qemail', 'qaddress', 'burlap', 'gender', 'primarystyle', 'yearsprimary', 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase')"; It inserts to the database but it is inserting the value names (ie, qname) instead of the actual value (field name) passed from the form. How do I fix this? thanks in advance
  6. Ok, finally got the error issue squared away. The problem was related to my submit button. I was posting 'submit' but looking for post 'submitted.' It's now picking up errors and telling visitors to fill out necessary fields if they miss them. Unfortunately, when you fill it out properly, I get the error: Could not connect to MySQL: Access denied for user 'username'@'localhost' (using password: YES) I have it set to look to a separate file for the connection info require_once ('../includes/mysql_connect.php'); this line is right above my insert. anyone see anything wrong with that? the info in the mysql_connect.php file is correct with the actual user and password
  7. I double-checked my php.ini file and errors are set to all. My db connection also works just fine. Absolutely lost as to why this isn't working and won't show me any errors.
  8. You bet, thanks for looking: <link href="qform.css" rel="stylesheet" type="text/css"> <?php #2008 survey ini_set('display_errors', 1); error_reporting(E_ALL); if (isset($_POST['submitted'])) { $errors = array(); //initialize error array. if (empty($_POST['burlap'])) { $errors[] = 'You did not enter your age.'; } if (empty($_POST['gender'])) { $errors[] = 'Please indicate your gender.'; } if (empty($_POST['primarystyle'])) { $errors[] = 'You did not enter your primary martial art.'; } if (empty($_POST['yearsprimary'])) { $errors[] = 'You did not enter the number of years training you have in your primary martial art.'; } if (empty($_POST['yearsgrappling'])) { $errors[] = 'You did not enter the number of years grappling experience you have.'; } if (empty($_POST['weekly'])) { $errors[] = 'Please indicate the number of weekly training sessions you participate in.'; } if (empty($_POST['visitorsince'])) { $errors[] = 'Please tell us how long you have been visiting this site.'; } if (empty($_POST['dvdpurchase'])) { $errors[] = 'You forgot to indicate the number of DVDs you have purchased.'; } if (empty($errors)){ //if all is error-free //then let's insert to database require_once ('../includes/mysql_connect.php'); $query = "INSERT INTO formresults (qname, qemail, qaddress, burlap, gender, primarystyle, yearsprimary, yearsgrappling, weekly, stephanquestion, visitorsince, dvdpurchase) VALUES ('qname', 'qemail', 'qaddress', 'burlap', 'gender', 'primarystyle', 'yearsprimary', 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase')"; $result = mysql_query ($query) or die(mysql_error()); //HERE if ($result) { echo '<h1 id="mainhead"> Thank You! </h1> <p> Your results have been included in our study. Please enjoy the rest of your visit to grapplearts.com </p>'; exit(); } else { echo '<h1 id="mainhead">System Error</h1> <p class="error"> Your submission could not be entered due to a server error. We apologize for the inconvenience.</p>'; echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; exit(); } mysql_close(); } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occured: <br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again. </p><p><br /></p>'; } } ?> <html> <table border="0"> <tr> <td width=20%> </td> <td width="60%" valign="top"> <form action="2008GrappleartsSurvey.php" method="post" name="2008q" > <div align="center"><span class="qheading">Grapplearts 2008 Questionnaire</span></div> <blockquote> <p>Thank you for taking the time to help us with our research. The information we receive from you, the MMA community, will help us ensure that we can continue to provide the best in tailored content and instructional resources on the web as well as our DVD catalogue.</p> <p><input name="qname" type="text" size="32" maxlength="32" /><br /> Your Name (optional)</p> <p><input name="qemail" type="text" value="" size="32" maxlength="32" /> <br /> Your Email (optional)</p> <p><textarea name="qaddress" cols="25" rows="5"></textarea> <br /> Shipping Address (optional)</p> <p><input name="burlap" type="text" size="32" maxlength="2" /> <br /> Your Age (Ex. 24) </p> <p> <select name="gender"> <p> <option> I am female </option> <option selected> I am male </option> </select> <br /> Your Gender</p> <p><select name="primarystyle"> <option selected>Please Select Best Choice</option> <option>Submission Wrestling</option> <option>Mixed Martial Arts</option> <option>Wrestling</option> <option>Boxing</option> <option>Chinese Martial Arts (Trad.)</option> <option>Filipino/Indonesian Martial Arts</option> <option>Japanese Martial Arts (Traditional)</option> <option>JKD</option> <option>Judo</option> <option>Kickboxing / Muay Thai</option> <option>Korean Martial Arts</option> <option>Other</option> </select> <br /> Your Primary Martial Art </p> <p> <input name="yearsprimary" type="text" id="years primary" size="32" maxlength="3" /> <br /> Years trained in primary martial art<br /> (Less that one year, enter 0.5) </p> <p> <input name="yearsgrappling" type="text" id="years grappling" size="32" maxlength="3" /><br /> Years trained in grappling <br /> (Less than one year, enter 0.5 </p> <p> <input name="weekly" type="text" id="years grappling" size="32" maxlength="3" /><br /> Number of weekly Martial Arts training sessions.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The single question about grappling you would most like to see Stephan Kesting answer.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The subject or topic you would most like to see covered in a future DVD release.</p> <p><select name="visitorsince" id="visitorsince" > <option selected>Joined less than one month ago</option> <option>one month to one year ago</option> <option>one year to three years ago </option> <option>more than three years ago</option> </select> <br /> I first visited grapplearts.com....</p> <p> <select name="dvdpurchase"> <option selected> 1 </option> <option> 2</option> <option> 3</option> <option> 4</option> <option>5 </option> <option>6 </option> <option>7 </option> <option>8</option></select> <br />How many Grapplearts DVDs have you purchased? (Here or elsewhere. Please enter a number) </p> <p> <input name ="submit" type="submit" value="Submit Answers" /> </p> <p> <input name="reset" type="reset" value=" Clear All Info " /> </p> <p> </p> </blockquote> </form> </td> <td width="20%"></td> </tr> </table> </html>
  9. changed the code to DarkWater's suggestion. I still get the blank form on submit and no info is being written to the db <link href="qform.css" rel="stylesheet" type="text/css"> <?php #2008 survey // maq suggestion error_reporting(E_ALL); ini_set('error_reporting', E_ALL); //maq done 1 if (isset($_POST['submitted'])) { $errors = array(); //initialize error array. if (empty($_POST['burlap'])) { $errors[] = 'You did not enter your age.'; } if (empty($_POST['gender'])) { $errors[] = 'Please indicate your gender.'; } if (empty($_POST['primarystyle'])) { $errors[] = 'You did not enter your primary martial art.'; } if (empty($_POST['yearsprimary'])) { $errors[] = 'You did not enter the number of years training you have in your primary martial art.'; } if (empty($_POST['yearsgrappling'])) { $errors[] = 'You did not enter the number of years grappling experience you have.'; } if (empty($_POST['weekly'])) { $errors[] = 'Please indicate the number of weekly training sessions you participate in.'; } if (empty($_POST['visitorsince'])) { $errors[] = 'Please tell us how long you have been visiting this site.'; } if (empty($_POST['dvdpurchase'])) { $errors[] = 'You forgot to indicate the number of DVDs you have purchased.'; } if (empty($erros)){ //if all is error-free //then let's insert to database require_once ('../includes/mysql_connect.php'); $query = "INSERT INTO formresults (qname, qemail, qaddress, burlap, gender, primarystyle, yearsprimary, yearsgrappling, weekly, stephanquestion, visitorsince, dvdpurchase) VALUES ('qname', 'qemail', 'qaddress', 'burlap', 'gender', 'primarystyle', 'yearsprimary', 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase')"; $result = mysql_query ($query) or die(mysql_error()); //HERE if ($result) { echo '<h1 id="mainhead"> Thank You! </h1> <p> Your results have been included in our study. Please enjoy the rest of your visit to grapplearts.com </p>'; exit(); } else { echo '<h1 id="mainhead">System Error</h1> <p class="error"> Your submission could not be entered due to a server error. We apologize for the inconvenience.</p>'; echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; exit(); } mysql_close(); } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occured: <br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again. </p><p><br /></p>'; } } ?> <html> <table border="0"> <tr> <td width=20%> </td> <td width="60%" valign="top"> <form action="2008GrappleartsSurvey.php" method="post" name="2008q" > <div align="center"><span class="qheading">Grapplearts 2008 Questionnaire</span></div> <blockquote> <p>Thank you for taking the time to help us with our research. The information we receive from you, the MMA community, will help us ensure that we can continue to provide the best in tailored content and instructional resources on the web as well as our DVD catalogue.</p> <p><input name="qname" type="text" size="32" maxlength="32" /><br /> Your Name (optional)</p> <p><input name="qemail" type="text" value="" size="32" maxlength="32" /> <br /> Your Email (optional)</p> <p><textarea name="qaddress" cols="25" rows="5"></textarea> <br /> Shipping Address (optional)</p> <p><input name="burlap" type="text" size="32" maxlength="2" /> <br /> Your Age (Ex. 24) </p> <p> <select name="gender"> <p> <option> I am female </option> <option selected> I am male </option> </select> <br /> Your Gender</p> <p><select name="primarystyle"> <option selected>Please Select Best Choice</option> <option>Submission Wrestling</option> <option>Mixed Martial Arts</option> <option>Wrestling</option> <option>Boxing</option> <option>Chinese Martial Arts (Trad.)</option> <option>Filipino/Indonesian Martial Arts</option> <option>Japanese Martial Arts (Traditional)</option> <option>JKD</option> <option>Judo</option> <option>Kickboxing / Muay Thai</option> <option>Korean Martial Arts</option> <option>Other</option> </select> <br /> Your Primary Martial Art </p> <p> <input name="yearsprimary" type="text" id="years primary" size="32" maxlength="3" /> <br /> Years trained in primary martial art<br /> (Less that one year, enter 0.5) </p> <p> <input name="yearsgrappling" type="text" id="years grappling" size="32" maxlength="3" /><br /> Years trained in grappling <br /> (Less than one year, enter 0.5 </p> <p> <input name="weekly" type="text" id="years grappling" size="32" maxlength="3" /><br /> Number of weekly Martial Arts training sessions.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The single question about grappling you would most like to see Stephan Kesting answer.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The subject or topic you would most like to see covered in a future DVD release.</p> <p><select name="visitorsince" id="visitorsince" > <option selected>Joined less than one month ago</option> <option>one month to one year ago</option> <option>one year to three years ago </option> <option>more than three years ago</option> </select> <br /> I first visited grapplearts.com....</p> <p> <select name="dvdpurchase"> <option selected> One DVD </option> <option> Two DVDs</option> <option> Three DVDs</option> <option> Four DVDs</option> <option>Five DVDs </option> <option>Six DVDs </option> <option>Seven DVDs </option> <option>All Eight DVDs</option></select> <br />How many Grapplearts DVDs have you purchased? (Here or elsewhere. Please enter a number) </p> <p> <input name ="submit" type="submit" value="Submit Answers" /> </p> <p> <input name="reset" type="reset" value=" Clear All Info " /> </p> <p> </p> </blockquote> </form> </td> <td width="20%"></td> </tr> </table> </html>
  10. :-\ doh! Thanks for spending the time to help me with my n00b issues maq, I appreciate it. Fixing that line now.
  11. thanks. Got it in the right spot now. it returned error: Parse error: syntax error, unexpected T_IF in /home/jgrapple/public_html/2008GrappleartsSurvey.php on line 49 line 49: if ($result) { in context below: 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase') or die(mysql_error())"; $result = @mysql_query ($query) if ($result) { echo '<h1 id="mainhead"> Thank You! </h1> <p> Your results have been included in our study. Please enjoy the rest of your visit to grapplearts.com </p>'; exit();
  12. Still reloads the blank form afterwards with no errors. is the following where you wanted the second snippet? $query = "INSERT INTO formresults (qname, qemail, qaddress, burlap, gender, primarystyle, yearsprimary, yearsgrappling, weekly, stephanquestion, visitorsince, dvdpurchase) VALUES ('qname', 'qemail', 'qaddress', 'burlap', 'gender', 'primarystyle', 'yearsprimary', 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase')"; $result = @mysql_query ($query) //maq suggestion or die("WTF?!" . mysql_error()); //maq done 2 if ($result) {
  13. Thanks. This is the code for the page <link href="qform.css" rel="stylesheet" type="text/css"> <?php #2008 survey if (isset($_POST['submitted'])) { $errors = array(); //initialize error array. if (empty($_POST['burlap'])) { $errors[] = 'You did not enter your age.'; } if (empty($_POST['gender'])) { $errors[] = 'Please indicate your gender.'; } if (empty($_POST['primarystyle'])) { $errors[] = 'You did not enter your primary martial art.'; } if (empty($_POST['yearsprimary'])) { $errors[] = 'You did not enter the number of years training you have in your primary martial art.'; } if (empty($_POST['yearsgrappling'])) { $errors[] = 'You did not enter the number of years grappling experience you have.'; } if (empty($_POST['weekly'])) { $errors[] = 'Please indicate the number of weekly training sessions you participate in.'; } if (empty($_POST['visitorsince'])) { $errors[] = 'Please tell us how long you have been visiting this site.'; } if (empty($_POST['dvdpurchase'])) { $errors[] = 'You forgot to indicate the number of DVDs you have purchased.'; } if (empty($erros)){ //if all is error-free //then let's insert to database require_once ('../includes/mysql_connect.php'); $query = "INSERT INTO formresults (qname, qemail, qaddress, burlap, gender, primarystyle, yearsprimary, yearsgrappling, weekly, stephanquestion, visitorsince, dvdpurchase) VALUES ('qname', 'qemail', 'qaddress', 'burlap', 'gender', 'primarystyle', 'yearsprimary', 'yearsgrappling', 'weekly', 'stephanquestion', 'visitorsince', 'dvdpurchase')"; $result = @mysql_query ($query); if ($result) { echo '<h1 id="mainhead"> Thank You! </h1> <p> Your results have been included in our study. Please enjoy the rest of your visit to grapplearts.com </p>'; exit(); } else { echo '<h1 id="mainhead">System Error</h1> <p class="error"> Your submission could not be entered due to a server error. We apologize for the inconvenience.</p>'; echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; exit(); } mysql_close(); } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occured: <br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p>Please try again. </p><p><br /></p>'; } } ?> <html> <table border="0"> <tr> <td width=20%> </td> <td width="60%" valign="top"> <form action="2008GrappleartsSurvey.php" method="post" name="2008q" > <div align="center"><span class="qheading">Grapplearts 2008 Questionnaire</span></div> <blockquote> <p>Thank you for taking the time to help us with our research. The information we receive from you, the MMA community, will help us ensure that we can continue to provide the best in tailored content and instructional resources on the web as well as our DVD catalogue.</p> <p><input name="qname" type="text" size="32" maxlength="32" /><br /> Your Name (optional)</p> <p><input name="qemail" type="text" value="" size="32" maxlength="32" /> <br /> Your Email (optional)</p> <p><textarea name="qaddress" cols="25" rows="5"></textarea> <br /> Shipping Address (optional)</p> <p><input name="burlap" type="text" size="32" maxlength="2" /> <br /> Your Age (Ex. 24) </p> <p> <select name="gender"> <p> <option> I am female </option> <option selected> I am male </option> </select> <br /> Your Gender</p> <p><select name="primarystyle"> <option selected>Please Select Best Choice</option> <option>Submission Wrestling</option> <option>Mixed Martial Arts</option> <option>Wrestling</option> <option>Boxing</option> <option>Chinese Martial Arts (Trad.)</option> <option>Filipino/Indonesian Martial Arts</option> <option>Japanese Martial Arts (Traditional)</option> <option>JKD</option> <option>Judo</option> <option>Kickboxing / Muay Thai</option> <option>Korean Martial Arts</option> <option>Other</option> </select> <br /> Your Primary Martial Art </p> <p> <input name="yearsprimary" type="text" id="years primary" size="32" maxlength="3" /> <br /> Years trained in primary martial art<br /> (Less that one year, enter 0.5) </p> <p> <input name="yearsgrappling" type="text" id="years grappling" size="32" maxlength="3" /><br /> Years trained in grappling <br /> (Less than one year, enter 0.5 </p> <p> <input name="weekly" type="text" id="years grappling" size="32" maxlength="3" /><br /> Number of weekly Martial Arts training sessions.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The single question about grappling you would most like to see Stephan Kesting answer.</p> <p> <textarea name="stephanquestion" cols="25" rows="5"></textarea><br /> The subject or topic you would most like to see covered in a future DVD release.</p> <p><select name="visitorsince" id="visitorsince" > <option selected>Joined less than one month ago</option> <option>one month to one year ago</option> <option>one year to three years ago </option> <option>more than three years ago</option> </select> <br /> I first visited grapplearts.com....</p> <p> <select name="dvdpurchase"> <option selected> One DVD </option> <option> Two DVDs</option> <option> Three DVDs</option> <option> Four DVDs</option> <option>Five DVDs </option> <option>Six DVDs </option> <option>Seven DVDs </option> <option>All Eight DVDs</option></select> <br />How many Grapplearts DVDs have you purchased? (Here or elsewhere. Please enter a number) </p> <p> <input name ="submit" type="submit" value="Submit Answers" /> </p> <p> <input name="reset" type="reset" value=" Clear All Info " /> </p> <p> </p> </blockquote> </form> </td> <td width="20%"></td> </tr> </table> </html>
×
×
  • 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.