Web Analytics Made Easy -
StatCounter Why won't my strtoupper code work? - CodingForum

Announcement

Collapse
No announcement yet.

Why won't my strtoupper code work?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Why won't my strtoupper code work?

    Maybe I'm missing something, but I can't seem to get it to work. This is my code:

    Code:
    while( $row= mysql_fetch_array( $rs) )
    {
    echo( "<div align='center'><h2>" . "Order Number: " . $row["orderid"] . "</h2>");
    echo( "<INPUT name='line1' type='text' value='" . $row["firstname"] . ' ' . ' ' . $row["lastname"] . "'>" . "<br>");
    echo( "<INPUT name='line2' type='text' value='" . $row["s_address"] . "'>" . "<br>");
    echo( "<INPUT name='line3' type='text' value='" . $row["s_city"] . ', ' . ' ' . $row["s_state"] . ' ' . ' ' . $row["s_zipcode"] . "'>" . "<br></div>");
    
    }
    Why can't I have

    Code:
    strtoupper( $row["firstname"] )
    in the middle? How would I return these values as uppercase?

  • #2
    Works for me.
    Code:
    <?php
    	$row['orderid'] = 'orderid';
    	$row['firstname'] = 'firstname';
    	$row['lastname'] = 'lastname';
    	$row['s_address'] = 's_address';
    	$row['s_city'] = 's_city';
    	$row['s_state'] = 's_state';
    	$row['s_zipcode'] = 's_zipcode';
    
    	echo( '<div><h2>Order Number: ' . strtoupper($row["orderid"]) . '</h2>');
    	echo( '<input name="line1" type="text" value="' . strtoupper($row["firstname"]) . ' ' . ' ' . strtoupper($row["lastname"]) . '"><br>');
    	echo( '<input name="line2" type="text" value="' . strtoupper($row["s_address"]) . '"><br>');
    	echo( '<input name="line3" type="text" value="' . strtoupper($row["s_city"]) . ', ' . ' ' . strtoupper($row["s_state"]) . ' ' . ' ' . strtoupper($row["s_zipcode"]) . '"><br></div>');
    ?>
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

    Comment

    Working...
    X