Jump to content

Recommended Posts

Hi Guys and Girls,

 

Long time lurker, first time poster!

 

I am usually able to read through the forums and find and answer without having to start a new thread but I've tried my best to no avail.

 

I am having trouble with the following code:

$afname="Gareth";
$alname="B";
$awayoption.="<OPTION VALUE=\"".$afname." \"".$alname."\">".$afname." ".$alname;

 

I would want that to produce the following:

 

<OPTION VALUE=Gareth B">Gareth B

 

The actual result at the moment is:

 

<OPTION VALUE="Gareth "B">Gareth B

 

It has an extra " in the middle. Any ides or help would be great!

 

Cheers

Wow thank you - worked a treat. I'm still at a very basic level at this point.

 

Is it a case of you can use {} to define variables then where you are using commas within commas, and this will allow a space in the middle? (Oh my I've just confused myself!)

 

Cheers

or even

 

$afname="Gareth";
$alname="B";
$awayoption.="<OPTION VALUE='$afname $alname'>$afname $alname";

 

can even combine them before like this

 

$afname="Gareth";
$alname="B";
$fullname = "$afname $alname";
$awayoption.="<OPTION VALUE='$fullname'>$fullname";

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.