2 questions T_String and this code

  • whatlikesit12345
  • Guru
  • Guru
  • User avatar
  • Posts: 1211

Post 3+ Months Ago

What are T_Strings and what is wrong with this code

PHP Code: [ Select ]
<INPUT TYPE="radio" NAME="grade" VALUE="9" CHECKED>9th
 
<INPUT TYPE="radio" NAME="grade" VALUE="10">10th
 
<INPUT TYPE="radio" NAME="grade" VALUE="11">11th
 
<INPUT TYPE="radio" NAME="grade" VALUE="12">12th
  1. <INPUT TYPE="radio" NAME="grade" VALUE="9" CHECKED>9th
  2.  
  3. <INPUT TYPE="radio" NAME="grade" VALUE="10">10th
  4.  
  5. <INPUT TYPE="radio" NAME="grade" VALUE="11">11th
  6.  
  7. <INPUT TYPE="radio" NAME="grade" VALUE="12">12th


//humm where did that ?> come from. did the php tags add it because its no in what i put?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • daremedy
  • Professor
  • Professor
  • daremedy
  • Posts: 911

Post 3+ Months Ago

you'll have to elaborate on that code, there's nothing wrong with the html but it all changes if its withing php code <? ?>, which it looks like you're doing. a t_string error usually occurs when php doesnt understand a string in your code, which means a quote could be missing, or a closing semi-colon, could be a number of things. but its hard to tell from the small code you gave in your example.
  • darkermoon
  • Expert
  • Expert
  • User avatar
  • Posts: 542
  • Loc: Riverdale, MD

Post 3+ Months Ago

I see the close PHP tag at the end.. add backslashes before the quotations, see if that fixes it.. I'm assuming this is a static form.. in which case, i don't know why just this part would be in PHP. But,
PHP Code: [ Select ]
<INPUT TYPE="radio" NAME="grade" VALUE="9" CHECKED>9th
would become
PHP Code: [ Select ]
<INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"9\" CHECKED>9th
I'm not positive this would fix it, and like I said, I'm not sure what exactly you're doing, but it won't hurt to try.

in which case, all of this would have to be in echo or equivalent, you can't just type it in the PHP section as normal HTML.
  • whatlikesit12345
  • Guru
  • Guru
  • User avatar
  • Posts: 1211

Post 3+ Months Ago

what i think i did is see the closing ?> that is a mistake. so that could be wrong. and it is in a echo so..

edit here is my entire code. its still there.

PHP Code: [ Select ]
<?php
 
session_start();
 
if ($_SESSION['email_address'] != "" ) {
 
   echo "<b>You do not have the appropriate permissions to enter new distributors.</b><br><br><br>";
 
 
 
 
 
if ( empty( $first_name ) ) {
 
   print "Please login below!";
 
   include 'tlogin.php';
 
 
 
}
 
} else { print "
 
 
 
<html>
 
<head>
 
<title>Join Form</title>
 
</head>
 
<body>
 
<form name=form1 method=post action=register9.php>
 
 <table width=100% border=0 cellpadding=4 cellspacing=0>
 
   <tr>
 
     <td width=24% align=left valign=top>First Name</td>
 
     <td width=76%><input name=first_name type=text id=first_name2></td>
 
   </tr>
 
   <tr>
 
     <td align=left valign=top>Last Name</td>
 
     <td><input name=last_name type=text id=last_name></td>
 
   </tr>
 
   <tr>
 
     <td align=left valign=top>What do Kids call you</td>
 
     <td><input name=kids_name type=text id=kids_name></td>
 
   </tr>
 
   <tr>
 
   <td align=left valign=top>What Grade do you teach</td>
 
     <td>
 
<INPUT TYPE="radio\" NAME=\"grade\" VALUE=\"9\" CHECKED>9th
 
<INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"10\">10th
 
<INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"11\">11th
 
<INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"12\">12th
 
 
 
</td>
 
   </tr>
 
 
 
   <tr>
 
     <td align=left valign=top>Email Address</td>
 
     <td><input name=email_address type=text id=email_address></td>
 
   </tr>
 
   <tr>
 
     <td align=left valign=top>Desired Username</td>
 
     <td><input name=username type=text id=username></td>
 
   </tr>
 
     <td align=left valign=top>Desired Password</td>
 
     <td><input name=password type=text id=password></td>
 
     </tr>
 
   <tr>
 
     <td align=left valign=top>Information about you:</td>
 
     <td><textarea name=info id=info></textarea></td>    </tr>
 
   <tr>
 
     <td align=left valign=top>&nbsp;</td>
 
     <td><input type=submit name=Submit value=Join Now!></td>
 
   </tr>
 
 </table>
 
</form>
 
</body>
 
</html>
 
 
 
"; } ?>
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if ($_SESSION['email_address'] != "" ) {
  6.  
  7.    echo "<b>You do not have the appropriate permissions to enter new distributors.</b><br><br><br>";
  8.  
  9.  
  10.  
  11.  
  12.  
  13. if ( empty( $first_name ) ) {
  14.  
  15.    print "Please login below!";
  16.  
  17.    include 'tlogin.php';
  18.  
  19.  
  20.  
  21. }
  22.  
  23. } else { print "
  24.  
  25.  
  26.  
  27. <html>
  28.  
  29. <head>
  30.  
  31. <title>Join Form</title>
  32.  
  33. </head>
  34.  
  35. <body>
  36.  
  37. <form name=form1 method=post action=register9.php>
  38.  
  39.  <table width=100% border=0 cellpadding=4 cellspacing=0>
  40.  
  41.    <tr>
  42.  
  43.      <td width=24% align=left valign=top>First Name</td>
  44.  
  45.      <td width=76%><input name=first_name type=text id=first_name2></td>
  46.  
  47.    </tr>
  48.  
  49.    <tr>
  50.  
  51.      <td align=left valign=top>Last Name</td>
  52.  
  53.      <td><input name=last_name type=text id=last_name></td>
  54.  
  55.    </tr>
  56.  
  57.    <tr>
  58.  
  59.      <td align=left valign=top>What do Kids call you</td>
  60.  
  61.      <td><input name=kids_name type=text id=kids_name></td>
  62.  
  63.    </tr>
  64.  
  65.    <tr>
  66.  
  67.    <td align=left valign=top>What Grade do you teach</td>
  68.  
  69.      <td>
  70.  
  71. <INPUT TYPE="radio\" NAME=\"grade\" VALUE=\"9\" CHECKED>9th
  72.  
  73. <INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"10\">10th
  74.  
  75. <INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"11\">11th
  76.  
  77. <INPUT TYPE=\"radio\" NAME=\"grade\" VALUE=\"12\">12th
  78.  
  79.  
  80.  
  81. </td>
  82.  
  83.    </tr>
  84.  
  85.  
  86.  
  87.    <tr>
  88.  
  89.      <td align=left valign=top>Email Address</td>
  90.  
  91.      <td><input name=email_address type=text id=email_address></td>
  92.  
  93.    </tr>
  94.  
  95.    <tr>
  96.  
  97.      <td align=left valign=top>Desired Username</td>
  98.  
  99.      <td><input name=username type=text id=username></td>
  100.  
  101.    </tr>
  102.  
  103.      <td align=left valign=top>Desired Password</td>
  104.  
  105.      <td><input name=password type=text id=password></td>
  106.  
  107.      </tr>
  108.  
  109.    <tr>
  110.  
  111.      <td align=left valign=top>Information about you:</td>
  112.  
  113.      <td><textarea name=info id=info></textarea></td>    </tr>
  114.  
  115.    <tr>
  116.  
  117.      <td align=left valign=top>&nbsp;</td>
  118.  
  119.      <td><input type=submit name=Submit value=Join Now!></td>
  120.  
  121.    </tr>
  122.  
  123.  </table>
  124.  
  125. </form>
  126.  
  127. </body>
  128.  
  129. </html>
  130.  
  131.  
  132.  
  133. "; } ?>


wtf is wrong with this php code tag.

There is a forward slash in the first radio after that first " so it should look like

"radio\"
  • daremedy
  • Professor
  • Professor
  • daremedy
  • Posts: 911

Post 3+ Months Ago

try something like this instead, i used a different form of echo where you dont need the \'s in front of quotes. i just tested it and your form shows up.

PHP Code: [ Select ]
 
<?php
 
session_start();
 
if ($_SESSION['email_address'] != "" ) {
 
   echo "<b>You do not have the appropriate permissions to enter new distributors.</b><br><br><br>";
 
 
 
 
 
if ( empty( $first_name ) ) {
 
   print "Please login below!";
 
   include 'tlogin.php';
 
 
 
}
 
}
 
 
 
else {
 
 
 
echo <<<OUTPUT
 
 
 
<html>
 
<head>
 
<title>Join Form</title>
 
</head>
 
<body>
 
<form name=form1 method=post action=register9.php>
 
  <table width=100% border=0 cellpadding=4 cellspacing=0>
 
    <tr>
 
      <td width=24% align=left valign=top>First Name</td>
 
      <td width=76%><input name=first_name type=text id=first_name2></td>
 
    </tr>
 
    <tr>
 
      <td align=left valign=top>Last Name</td>
 
      <td><input name=last_name type=text id=last_name></td>
 
    </tr>
 
    <tr>
 
      <td align=left valign=top>What do Kids call you</td>
 
      <td><input name=kids_name type=text id=kids_name></td>
 
    </tr>
 
    <tr>
 
    <td align=left valign=top>What Grade do you teach</td>
 
      <td>
 
<INPUT TYPE="radio" NAME="grade" VALUE="9" CHECKED>9th
 
<INPUT TYPE="radio" NAME="grade" VALUE="10">10th
 
<INPUT TYPE="radio" NAME="grade" VALUE="11">11th
 
<INPUT TYPE="radio" NAME="grade" VALUE="12">12th
 
 
 
</td>
 
    </tr>
 
 
 
    <tr>
 
      <td align=left valign=top>Email Address</td>
 
      <td><input name=email_address type=text id=email_address></td>
 
    </tr>
 
    <tr>
 
      <td align=left valign=top>Desired Username</td>
 
      <td><input name=username type=text id=username></td>
 
    </tr>
 
      <td align=left valign=top>Desired Password</td>
 
      <td><input name=password type=text id=password></td>
 
      </tr>
 
    <tr>
 
      <td align=left valign=top>Information about you:</td>
 
      <td><textarea name=info id=info></textarea></td>    </tr>
 
    <tr>
 
      <td align=left valign=top>&nbsp;</td>
 
      <td><input type=submit name=Submit value=Join Now!></td>
 
    </tr>
 
  </table>
 
</form>
 
</body>
 
</html>
 
 
 
OUTPUT;
 
}
 
 ?>
 
 
  1.  
  2. <?php
  3.  
  4. session_start();
  5.  
  6. if ($_SESSION['email_address'] != "" ) {
  7.  
  8.    echo "<b>You do not have the appropriate permissions to enter new distributors.</b><br><br><br>";
  9.  
  10.  
  11.  
  12.  
  13.  
  14. if ( empty( $first_name ) ) {
  15.  
  16.    print "Please login below!";
  17.  
  18.    include 'tlogin.php';
  19.  
  20.  
  21.  
  22. }
  23.  
  24. }
  25.  
  26.  
  27.  
  28. else {
  29.  
  30.  
  31.  
  32. echo <<<OUTPUT
  33.  
  34.  
  35.  
  36. <html>
  37.  
  38. <head>
  39.  
  40. <title>Join Form</title>
  41.  
  42. </head>
  43.  
  44. <body>
  45.  
  46. <form name=form1 method=post action=register9.php>
  47.  
  48.   <table width=100% border=0 cellpadding=4 cellspacing=0>
  49.  
  50.     <tr>
  51.  
  52.       <td width=24% align=left valign=top>First Name</td>
  53.  
  54.       <td width=76%><input name=first_name type=text id=first_name2></td>
  55.  
  56.     </tr>
  57.  
  58.     <tr>
  59.  
  60.       <td align=left valign=top>Last Name</td>
  61.  
  62.       <td><input name=last_name type=text id=last_name></td>
  63.  
  64.     </tr>
  65.  
  66.     <tr>
  67.  
  68.       <td align=left valign=top>What do Kids call you</td>
  69.  
  70.       <td><input name=kids_name type=text id=kids_name></td>
  71.  
  72.     </tr>
  73.  
  74.     <tr>
  75.  
  76.     <td align=left valign=top>What Grade do you teach</td>
  77.  
  78.       <td>
  79.  
  80. <INPUT TYPE="radio" NAME="grade" VALUE="9" CHECKED>9th
  81.  
  82. <INPUT TYPE="radio" NAME="grade" VALUE="10">10th
  83.  
  84. <INPUT TYPE="radio" NAME="grade" VALUE="11">11th
  85.  
  86. <INPUT TYPE="radio" NAME="grade" VALUE="12">12th
  87.  
  88.  
  89.  
  90. </td>
  91.  
  92.     </tr>
  93.  
  94.  
  95.  
  96.     <tr>
  97.  
  98.       <td align=left valign=top>Email Address</td>
  99.  
  100.       <td><input name=email_address type=text id=email_address></td>
  101.  
  102.     </tr>
  103.  
  104.     <tr>
  105.  
  106.       <td align=left valign=top>Desired Username</td>
  107.  
  108.       <td><input name=username type=text id=username></td>
  109.  
  110.     </tr>
  111.  
  112.       <td align=left valign=top>Desired Password</td>
  113.  
  114.       <td><input name=password type=text id=password></td>
  115.  
  116.       </tr>
  117.  
  118.     <tr>
  119.  
  120.       <td align=left valign=top>Information about you:</td>
  121.  
  122.       <td><textarea name=info id=info></textarea></td>    </tr>
  123.  
  124.     <tr>
  125.  
  126.       <td align=left valign=top>&nbsp;</td>
  127.  
  128.       <td><input type=submit name=Submit value=Join Now!></td>
  129.  
  130.     </tr>
  131.  
  132.   </table>
  133.  
  134. </form>
  135.  
  136. </body>
  137.  
  138. </html>
  139.  
  140.  
  141.  
  142. OUTPUT;
  143.  
  144. }
  145.  
  146.  ?>
  147.  
  148.  
  • darkermoon
  • Expert
  • Expert
  • User avatar
  • Posts: 542
  • Loc: Riverdale, MD

Post 3+ Months Ago

I never knew about that daremedy that's an awesome tip. btw, your sig is amazingly hilarious.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 93 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.