www.webdeveloper.com
Results 1 to 4 of 4

Thread: Simple 2 second question...

Hybrid View

  1. #1
    Join Date
    Mar 2012
    Posts
    8

    Simple 2 second question...

    This is what I have ...

    Code:
    			      		<option value="
    				  		<?php echo $row['Team_Name']; echo $row['Team_Value']; ?>">
    				  		<?php echo $row['Team_Name']; echo $row['Team_Value']; ?>
    				  		</option>
    What it outputs is TeamName98

    I need it to output "TeamName 98", with the space in the centre, how can I ammend the code so it works like such....

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    PHP Code:
    <?php echo "{$row['Team_Name']} {$row['Team_Value']}"?>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Dec 2011
    Location
    Centurion, South Africa
    Posts
    795
    You can use the period (.) to concatenate strings:

    PHP Code:
                              <option value="
                                  <?php echo $row['Team_Name'] . ' ' $row['Team_Value']; ?>">
                                  <?php echo $row['Team_Name'] . ' ' $row['Team_Value']; ?>
                              </option>
    http://php.net/manual/en/language.operators.string.php
    JavaScript: Learn | Validate | Compact | bionoid

  4. #4
    Join Date
    Mar 2012
    Posts
    8
    Bionoid, that's the answer I was looking for. You just saved me lots and lots of work, and it's not just this example I've been wanting that little piece of information for.

    Thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles