Jump to content

sdyates2001

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Everything posted by sdyates2001

  1. Folks, it was the file encoding... despite setting UTF-8, it was encoding in another format! Everything works well now!
  2. I get the same error message "Parse error: syntax error, unexpected " - from the line with the if statement
  3. I get the same error as before "Parse error: syntax error, unexpected " Line two starts with if(isset...
  4. The attached version info is in a jpg. Also attached is the first file - it is too big to just paste in here and I am not very happy with the efficiency. [attachment deleted by admin]
  5. You'll love this, it says: Fatal error: Call to undefined function php_version()
  6. Hence my head scratching... I wonder if it is Netfirms. Does anyone have an account with netfirms that has basic code doing what I am trying to do? Perhaps they have an older version of PHP - I would expect that they are using ver 5.
  7. The code that generated the error is immediately below which was recommended to me in a few previous posts. For some reason, it does not like the while command. <?php //Make a loop to get the values $i = 1; while (isset($_POST['ch'.$i])) { $QUESTIONS[] = trim($_POST['ch'.$i]); $i++; } print_r($QUESTIONS); # For the first 13 array elements, add 1 value to $PositiveFirstCriteria $PositiveFirstCriteria = 0; for ($count=0; $count<13; $count++) { if ( $QUESTIONS['ch'.$count] == "Question" ) { $PositiveFirstCriteria++; echo "<p>Count: $count, $PositiveFirstCriteria</p>"; } } # If $PositiveFirstCriteria > 6 (@ScreenPositive) # If yes to $PositiveSecondCriteria and moderate or serious to $PositiveThirdCriteria ?> Here is a snippet of the code that sends the info to this page: FORM NAME ="form1" METHOD ="POST" ACTION ="bob.php"> <Input type = 'Checkbox' Name ='ch1' value ="Question" <?PHP print $ch1; ?> >Has there ever been a period of time when you were not your usual self and... <P> <Input type = 'Checkbox' Name ='ch2' value="Question" <?PHP print $ch2; ?> >...you felt so good or so hyper tat other people thought you were not your normal self or you were so hyper that you got into trouble? <P> <Input type = 'Checkbox' Name ='ch3' value="Question" <?PHP print $ch3; ?> >...you were so irritable that you shouted at people or started fights or arguments?
  8. I am beginning to wonder if netfirms is using some kind of modified strange version of PHP. I even copied the code word for word and it generated a Parse error: syntax error, unexpected '{' in ... on line 5. Are there different versions of commands I need to be aware of? I honestly can't believe I am having trouble with basic code >>thanks for the comment on name= "questions[]" - I'll try rewrite later once I get logic to work
  9. Let me show you my script... <?php $QUESTIONS = array ( $_POST['ch1'], $_POST['ch2'], $_POST['ch3'], $_POST['ch4'], $_POST['ch5'], $_POST['ch6'], $_POST['ch7'], $_POST['ch8'], $_POST['ch9'], $_POST['ch10'],$_POST['ch11'], $_POST['ch12'], $_POST['ch13'], $_POST['ch14'], $_POST['ch15'],); print_r($QUESTIONS); # For the first 13 array elements, add 1 value to $PositiveFirstCriteria $count = ""; while ( $count < 13 ) { if ( $QUESTIONS['ch.$count'] == "Question" ) { $PositiveFirstCriteria += 1; echo "<p>Count: $count, $PositiveFirstCriteria"; } $count += 1; } # If $PositiveFirstCriteria > 6 (@ScreenPositive) # If yes to $PositiveSecondCriteria and moderate or serious to $PositiveThirdCriteria ?> The output from print_r is: Array ( [0] => Question [1] => Question [2] => [3] => [4] => [5] => [6] => [7] => Question 8 [8] => [9] => [10] => [11] => [12] => [13] => [14] => ) So, I know I am returning "Question" on the first two, but the if statement is never true . I even tried to echo each element in the array such as $Question[1], but it appears once again I am mixing up perl.
  10. @All - Thanks adding the . in ch.$count was it. ++ and += both work
  11. My PHP coding has become more advanced since yesterday, but I am still thinking like perl. Instead of wasting space, I want to ask if $Questions['ch1...13'] is not equal to "", then to perform a statement block. Could you please assist me with where I am going wrong? $count = ""; while ( $count < 13 ) { if ( $Questions['ch$count'] != "" ) { $PositiveFirstCriteria += 1; echo "<p>Count: $count, $PositiveFirstCriteria</p>"; } $count += 1; } Thanks in advance to anyone who takes the time to respond!
  12. @Suden Perfect! Thanks so much. I appreciate everyone's help - you have all helped me get to where I need to be
  13. @rubing Thanks. I have been working for sometime... my perl is getting int he way. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Questionnaire :: Sheri.com</title> <form id="form1" name="form1" method="post" action="bob.php"> <table width="200"> <tr><td><font face='Arial' size='2'>Question 1</td> <td><input type='checkbox' name='sports' value='$ARRAY[0]'> </tr> <tr><td><font face='Arial' size='2'>Question 2</td> <td><input type='checkbox' name='sports' value='$ARRAY[1]'> </tr> <tr><td><font face='Arial' size='2'>Question 3</td> <td><input type='checkbox' name='sports' value='$ARRAY[2]'> </tr> <tr><td><font face='Arial' size='2'>Question 4</td> <td><input type='checkbox' name='sports' value='$ARRAY[3]'> </tr> </table> <label></label> <label>Submit <input type="submit" name="submit" value="Submit" /> </label> </form> I need check boxes because I need to return the value for each check box. I need to know which ones were checked and which ones were not. When I display, I am not getting an array back. I am just getting $ARRAY[3] or another value, but not what it is... <?php $anwser = $_POST['sports']; echo $anwser; ?> I know this is simple, but I can't seem to bridge the perl gap
  14. I seek your wisdom and direction. I am an experienced perl programmer and am assisting a friend with some php code. While I am good with perl and know the resources to use when in need, I can't say that with php. I am looking to create a simple questionnaire that consists of about 15 questions resulting in a yes or a no. Based on the response, I will forward this array to another page, perform a simple if then logic that will see one of three html pages display. While I have Programming PHP, I am having trouble as this book is not tailoured to what I need to do. As I don't believe if having others do my code for me, I am good at reverse engineering code for my own needs. Could someone please provide me some sample code similar to what I am asking or a good tutorial page for what I need. Thanks Kindly, S
×
×
  • 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.