Variable mit mehreren Zeilen!

HansLaass

Grünschnabel
Hallo!

Ich habe mir ein Template gebaut und dort gibt es die Variable "$inhalt".
Ich habe nun folgenden Code eingegeben um die variable zu ersetzen, aber ich finde den fehler leider nicht!
PHP:
$titel = "The WebCorner Vol. 2";
//Der Inhalt wird festgelegt
$inhalt = 
echo "    <form action='http://link2.map24.com' method='get' target='_blank'>"
echo "    <input type='hidden' name='action' value='route'>"
echo "    <input type='hidden' name='language' value='de'>"
echo "    <input type='hidden' name='lid' value='e263b083'>"
echo "    <input type='hidden' name='maptype' value='CGIJS'>"
echo "    <input type='hidden' name='width' value='8000'>"
echo "    <div align='center'>"
echo "<table class='formtab' cellspacing='1' cellpadding='2' width='353' height='110'>"
echo "<tr>"
echo "  <td class='formtop' colspan='2' width='353' height='19'> "
echo "<b>Startadresse:</b></td></tr><tr>"
echo "    <td class='mid' width='100' height='19'><b>PLZ/Ort:</b></td>"
echo "    <td class='mid' width='253' align='center' height='19'> "
echo "<p>"
echo "<input class='input' style='width: 50; text-align: center' maxLength='5' size='3' name='szip' tabindex='1'>&nbsp;"
echo "<input class='input' style='width: 192' name='scity' size='15' tabindex='2'></font></td></tr><tr>"
echo "    <td class='mid' width='100' height='19'><b>Straße+Nr.:</b></td>"
echo "    <td class='mid' width='253' align='center' height='19'> "
echo "<input class='input' name='sstreet' size='24' tabindex='3'></td></tr><tr>"
echo "    <td class='mid' width='100' height='1'><b>Land:</b></td>"
echo "    <td class='mid' width='253' align='center' height='1'>"
echo "<select class='input' size='1' name='scountry' tabindex='4'>"
echo "<option value='DE' selected>Deutschland</option>"
echo "<option value='AT'>Österreich</option>"
echo "<option value='CH'>Schweiz</option>"
echo "</select></td></tr>"
echo "  </table>"
echo "  <font size='1'>&nbsp;</font><br><table class='formtab' cellspacing='1' cellpadding='2' width='353' height='110'>"
echo "<tr>"
echo "  <td class='formtop' colspan='2' width='353' height='19'> "
echo "<b>Zieladresse:</b></td></tr><tr>"
echo "    <td class='mid' width='100' height='19'><b>PLZ/Ort:</b></td>"
echo "    <td class='mid' width='253' align='center' height='19'> "
echo "<p>"
echo "<input class='input' style='width: 50; text-align: center' maxLength='5' size='3' name='dzip' tabindex='5'>&nbsp;"
echo "<input class='input' style='width: 192' name='dcity' size='15' tabindex='6'></td></tr><tr>"
echo "    <td class='mid' width='100' height='19'><b>Straße+Nr.:</b></td>"
echo "    <td class='mid' width='253' align='center' height='19'> "
echo "<input class='input' name='dstreet' size='24' tabindex='7'></font></td></tr><tr>"
echo "    <td class='mid' width='100' height='1'><b>Land:</b></td>"
echo "    <td class='mid' width='253' align='center' height='1'>"
echo "<select class='input' size='1' name='dcountry' tabindex='8'>"
echo "<option value='DE' selected>Deutschland</option>"
echo "<option value='AT'>Österreich</option>"
echo "<option value='CH'>Schweiz</option>"
echo "</select></td></tr>"
echo "  </table>"
echo "  <font size='1'>&nbsp;</font><br>"
echo "  <table class='formtab' cellpadding='2' cellspacing='1' width='353' height='52'>"
echo "    <tr>"
echo "      <td class='formtop' width='353' height='19' colspan='4'><b>Optimierung:</b></td>"
echo "    </tr>"
echo "    <tr>"
echo "      <td class='mid' width='353' height='23' colspan='4'>"
echo "      <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor=#111111 width='100%'>"
echo "        <tr>"
echo "          <td width='40%' align='center'><b>Schnellste Route</b></td>"
echo "          <td width='5%' align='center'><b>"
echo "          <input type='radio' CHECKED value='fast' name='rtype' tabindex='9'></b></td>"
echo "          <td width='10%' align='center'>&nbsp;</td>"
echo "          <td width='5%' align='center'><b>"
echo "          <input type='radio' value='short' name='rtype' tabindex='9'></b></td>"
echo "          <td width='40%' align='center'><b>Kürzeste Route</b></td>"
echo "        </tr>"
echo "      </table>"
echo "      </td>"
echo "    </tr>"
echo "  </table><font size='1'>&nbsp;</font><br>"
echo "  <table class='formtab' cellpadding='2' cellspacing='1' width='354'>"
echo "    <tr>"
echo "      <td class='formtop' width='354' height='15' colspan='4'><b>Route Ermitteln:</b></td>"
echo "    </tr>"
echo "    <tr>"
echo "      <td class='mid' width='354' height='15' colspan='4'>"
echo "      <p align='center'> "
echo "<button class='button' style='width: 142; height: 27' type='submit' tabindex='11'><b>"
echo "<font size='3' face='Times New Roman'>LOS!</font></b></button></td>"
echo "    </tr>"
echo "  </table>"
echo "  </center>"
echo "</div>"
echo "</form>";

Könnt ihr mir da helfen? da muss irgendwo ein Syntax-Fehler sein!

Lg,
Hans.
 
*ganz ruhig bleiben*
*ich werd mich nicht aufregen*
*ich bleibe ganz ruhig*

*nerfenzusammenbuch hatt*

echo gibt eine zeile aus, hatt absolut nix mit variablen zu tun...

entweder du machst es so:

$blabla = "zeile 1".
"zeile 2".
"zeile 3".
"zeile 4";

oder du machst es so:

$blabla =<<<CONTENTDATAEOF
zeile 1
zeile 2
zeile 3
zeile 4
zeile 5
...
CONTENTDATAEOF;

also versuchs mal so:

PHP:
$inhalt =<<<CONTENTDATAEOF
<form action='http://link2.map24.com' method='get' target='_blank'>
    <input type='hidden' name='action' value='route'>
    <input type='hidden' name='language' value='de'>
    <input type='hidden' name='lid' value='e263b083'>
    <input type='hidden' name='maptype' value='CGIJS'>
    <input type='hidden' name='width' value='8000'>
    <div align='center'>
<table class='formtab' cellspacing='1' cellpadding='2' width='353' height='110'>
<tr>
  <td class='formtop' colspan='2' width='353' height='19'> 
<b>Startadresse:</b></td></tr><tr>
    <td class='mid' width='100' height='19'><b>PLZ/Ort:</b></td>
    <td class='mid' width='253' align='center' height='19'> 
<p>
<input class='input' style='width: 50; text-align: center' maxLength='5' size='3' name='szip' tabindex='1'>&nbsp;
<input class='input' style='width: 192' name='scity' size='15' tabindex='2'></font></td></tr><tr>
    <td class='mid' width='100' height='19'><b>Straße+Nr.:</b></td>
    <td class='mid' width='253' align='center' height='19'> 
<input class='input' name='sstreet' size='24' tabindex='3'></td></tr><tr>
    <td class='mid' width='100' height='1'><b>Land:</b></td>
    <td class='mid' width='253' align='center' height='1'>
<select class='input' size='1' name='scountry' tabindex='4'>
<option value='DE' selected>Deutschland</option>
<option value='AT'>Österreich</option>
<option value='CH'>Schweiz</option>
</select></td></tr>
  </table>
  <font size='1'>&nbsp;</font><br><table class='formtab' cellspacing='1' cellpadding='2' width='353' height='110'>
<tr>
  <td class='formtop' colspan='2' width='353' height='19'> 
<b>Zieladresse:</b></td></tr><tr>
    <td class='mid' width='100' height='19'><b>PLZ/Ort:</b></td>
    <td class='mid' width='253' align='center' height='19'> 
<p>
<input class='input' style='width: 50; text-align: center' maxLength='5' size='3' name='dzip' tabindex='5'>&nbsp;
<input class='input' style='width: 192' name='dcity' size='15' tabindex='6'></td></tr><tr>
    <td class='mid' width='100' height='19'><b>Straße+Nr.:</b></td>
    <td class='mid' width='253' align='center' height='19'> 
<input class='input' name='dstreet' size='24' tabindex='7'></font></td></tr><tr>
    <td class='mid' width='100' height='1'><b>Land:</b></td>
    <td class='mid' width='253' align='center' height='1'>
<select class='input' size='1' name='dcountry' tabindex='8'>
<option value='DE' selected>Deutschland</option>
<option value='AT'>Österreich</option>
<option value='CH'>Schweiz</option>
</select></td></tr>
  </table>
  <font size='1'>&nbsp;</font><br>
  <table class='formtab' cellpadding='2' cellspacing='1' width='353' height='52'>
    <tr>
      <td class='formtop' width='353' height='19' colspan='4'><b>Optimierung:</b></td>
    </tr>
    <tr>
      <td class='mid' width='353' height='23' colspan='4'>
      <table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor=#111111 width='100%'>
        <tr>
          <td width='40%' align='center'><b>Schnellste Route</b></td>
          <td width='5%' align='center'><b>
          <input type='radio' CHECKED value='fast' name='rtype' tabindex='9'></b></td>
          <td width='10%' align='center'>&nbsp;</td>
          <td width='5%' align='center'><b>
          <input type='radio' value='short' name='rtype' tabindex='9'></b></td>
          <td width='40%' align='center'><b>Kürzeste Route</b></td>
        </tr>
      </table>
      </td>
    </tr>
  </table><font size='1'>&nbsp;</font><br>
  <table class='formtab' cellpadding='2' cellspacing='1' width='354'>
    <tr>
      <td class='formtop' width='354' height='15' colspan='4'><b>Route Ermitteln:</b></td>
    </tr>
    <tr>
      <td class='mid' width='354' height='15' colspan='4'>
      <p align='center'> 
<button class='button' style='width: 142; height: 27' type='submit' tabindex='11'><b>
<font size='3' face='Times New Roman'>LOS!</font></b></button></td>
    </tr>
  </table>
  </center>
</div>
</form>
CONTENTDATAEOF;
 
Ich versteh noch nicht ganz was du da machen möchtest.
Willst du etwas in einer Variable Abspeichern oder mit echo("") ausgeben?
Und du hast die " " bei der Variable vergessen.
Ich würd es so machen:
PHP:
$titel = "The WebCorner Vol. 2";
//Der Inhalt wird festgelegt
$inhalt = "<form action='http://link2.map24.com' method='get' target='_blank'>
<input type='hidden' name='action' value='route'>
.
.
.
</div>
</form>";
Nachher kannst du die ganze Variable mit:
PHP:
echo("$inhalt");
Ausgeben.

Gruß
 
Danke euch beiden!
Anmeinem Text hat man sicherlich schon gemerkt, dass ich nicht so bewandert bin in php, aber will es jetzt lernen und habe das jetzt auch verstanden!
Und falls ich wieder nicht klar komme, melde ich mich wieder!

Lg,
Hans.
 
@HansLaass: An Deinem ursprünglichen Code war nur falsch, dass Du das Semikolon am Ende der Echo-Anweisung vergessen hast!
PHP:
echo "irgendwas";
mfg, snuu
 
Zurück