Jump to content

thefortrees

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

Everything posted by thefortrees

  1. Just put it in outside of one of the if statements
  2. Use echo or print. echo - http://us.php.net/manual/en/function.echo.php print - http://us.php.net/manual/en/function.print.php
  3. like thorpe said, you have to write the getfirst() function yourself.
  4. Thanks for the help - never knew you could do that. But anyway, I just came home from work and tried it on my computer at home... works here.... haha - didnt change anything.
  5. try removing the single quotes from around $table
  6. Those are different encrypt methods. not a secure connection, BUT they are extremely secure and nearly impossible to decipher.
  7. Alright - so, I have been trying to get this working all afternoon. I am writing a script to process a huge survey and store the form values in a database. EVERYTHING works but this one array (from HTML form). I'm sure it is a small problem. Any help is appreciated!! Here is the error (I echo other arrays to test that my loop works properly before and after the one with the problem, as can be seen by the printed values.): Web Developers Client Services Database Developers Web Developers Marketing Consulting Database Developers Warning: Invalid argument supplied for foreach() in /export/home/sevanet/twright/public_html/clientsurvey/temp/survey_handler.php on line 44 Useful Timely Interesting Informative Useful Interesting Informative -------------------------------------------------------------------- Here is the HTML code for the field (checkboxes) that is causing the problems: <div class="field"> <label for="uname">(Select as many as apply.) <em></em> </label> <ul> <li><input type="checkbox" name="choose_vectec[]" value="Training">Training</li> <li><input type="checkbox" name="choose_vectec[]" value="Superior Services">Superior Services</li> <li><input type="checkbox" name="choose_vectec[]" value="One on one consulting">One on one consulting</li> <li><input type="checkbox" name="choose_vectec[]" value="Reliability">Reliability</li> <li><input type="checkbox" name="choose_vectec[]" value="Operations Analysis">Operations Analysis</li> <li><input type="checkbox" name="choose_vectec[]" value="Cost">Cost</li> <li><input type="checkbox" name="choose_vectec[]" value="Continuing Education">Continuing Education</li> <li><input type="checkbox" name="choose_vectec[]" value="Private sector services not available">Private sector services not available</li> <li><input type="checkbox" name="choose_vectec[]" value="Private sector services not good">Private sector services not good</li> </ul> </div> ----------------------------------------------------------------------------------- And here is the PHP code from line 44 that processes each array in the form, but only has an error when it reaches ($key == 'choose_vectec'): foreach($_POST as $key => $value){ $passcode = $_COOKIE['passcode']; $user = $_POST['user']; $answer = $value; if ( ($key == 'received_service') || ($key == 'available_sector') || ($key == 'choose_vectec') || ($key == 'use_pensoft2') || ($key == 'use_ctdi2') ){ foreach($_POST[$key] as $values){ $answer .= $values . ' '; $search = "Array"; $replace = ""; $answer = str_replace($search, $replace, $answer); } //echo $answer; } $query = "INSERT INTO answers (passcode, user, questionID, answer) VALUES ('$passcode', '$user', '$qid', '$answer');"; mysql_query($query); $qid++; }
  8. i was just wondering - read in an article that use of relative URLs with header causes problems in some browsers, so only absolute URLs shoudl be used. ive always used relative URLs with header to redirect. what do you all think?
  9. I have been looking around for a while trying to find any other alternatives to the header function. ---- ie: header('Location: http://www.phpfreaks.com'); --- Does anybody know of any other options?
  10. variable posts over - i echoed it to make sure of that. one weird thing - in my html form method is post but $_POST['passcode'] doesn't work. however, $_GET['passcode'] does (posting the variable to the script i mean)
  11. Hi all - I have created an online survey, and the script I am having problems with is a simple entry page where you enter a code given to you that will be stored in the database with each question you answer to track who answered it. The script never enters the second if statement, so you can never get to index.php. Any ideas? $dbhost = '***; $dbuser = '***'; $dbpass = '***'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'vecsurvey'; mysql_select_db($dbname); //Passcode to log on to survey that is unique to each company. $passcode = $_GET['passcode']; $query = "SELECT * FROM clients WHERE passcode = '$passcode';"; $result = mysql_query($query); if ( mysql_num_rows($result) == 0){ header('Location: ../login.html'); } if ( mysql_num_rows($result) == 1 ){ //surveyID cookie will be used in the answers table to tie each answer with a specific //company. Expires after 2 hours. setcookie("passcode", $passcode, time()+7200); header('Location: ../index.php'); }
×
×
  • 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.