Jump to content


Photo

Help with Connecting Strings


  • Please log in to reply
1 reply to this topic

#1 daughn888

daughn888
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 July 2006 - 08:39 PM

Okay

I tried that ...

Here is the program I'm trying to write to learn php.

--------------------------------------------------------------------------------------

<?php

//import form information
$question1a = $_POST['q1'];
$question1b = $_POST['q2'];
$question1 = $question1a.', '.$question1b;

if ($question1a != "happiness") {
echo "Sorry, the answer is results. \n ";
echo "Please hit your back button and try again.";
}

if ($question1b != "floatation") {
echo "Sorry, the answer is misc. \n ";
echo "Please hit your back button and try again.
}

if ($question1 == "results, misc.") {          <--  This is the line that keeps giving me a parsing error
header('Location: thankyou.html');

------------------------------------------------------------------------------
What is the syntax for line 18?

Thanks again!
       


#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 15 July 2006 - 08:41 PM

try this:

$string1 = $string1a.', '.$string1b;

this will insert a ", " between your two strings.  otherwise if $string1a is "results" and $string1b is "misc", your current line would be giving resultsmisc (ie. connecting them directly together).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users