Jump to content

Recommended Posts

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.") {          [i][b] <--  This is the line that keeps giving me a parsing error[/b][/i]
header('Location: thankyou.html');

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

Thanks again!
       
Link to comment
https://forums.phpfreaks.com/topic/14702-help-with-connecting-strings/
Share on other sites

try this:

[code]$string1 = $string1a.', '.$string1b;[/code]

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).
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.