pozry ono to je takto. mam dva - prakticky tie iste kody a jeden funguje a druhy nie. neviem preco.
kod 1 - funkcny:
Kód:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
</head>
<form action="nieco.php" method="post">
<tr>
<td colspan="2" align="center">Vyberte prosím, atd ..............:<p>
<script>var texty = ['', '<font>nejaky text.</font></td></tr><tr><td width="150px"><b>asf:</b></td><td><input type="text" name="asfd" maxlength="255"></td></tr><tr><td width="150px"><b>Pristupové meno:</b></td><td><input type="text" name="name" maxlength="255"></td></tr><tr><td width="150px"><b>Pristupové heslo:</b></td><td><input type="password" name="password" maxlength="255"></td></tr><tr><td width="150px"><b>Databáza:</b></td><td><input type="text" name="database" maxlength="255"></td></tr>', '<font>nejaky text. <br> nejaky text.</font>'];</script>
<select name="select" onchange="document.getElementById('text').innerHTML=texty[this.selectedIndex]">
<option value="1" selected>vybrať...</option>
<option value="2">1 moeznost</option>
<option value="3">2 moznost</option>
</select>
<tr>
<td colspan="2" align="left"><p id=text></td>
</tr>
<tr>
<td colspan="2" align="center">
<hr><br>
<input type="hidden" value="2" name="step">
<input type="submit" value=">>" name="submit">
</form>
</td></tr>
<?php
print_r( $_POST );
?>
print_r ma vysledok: Array ( [select] => 2 [asfd] => fgjhfgjh [name] => fgjhfj [password] => ghjfgj [database] => ghjfj [step] => 2 [submit] => >> )
teraz kod 2 - nefunkcny:
Kód:
<?php
switch( $_POST['step'] ) {
case '':
?>
<html>
<head>
<title>krok 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<link rel="stylesheet" media="all" href="styles/basic.css">
</head>
<body>
<table align="center" bgcolor="white" >
<tr>
<td colspan="2" align="center"><h1>text<br><hr></h1></td>
</tr>
<form action="nieco2.php" method="post">
<tr>
<td colspan="2" align="center">text:<p>
<script>var texty = ['', '<font>text.</font></td></tr><tr><td width="150px"><b>Server:</b></td><td><input type="text" name="server" maxlength="255"></td></tr><tr><td width="150px"><b>Pristupové meno:</b></td><td><input type="text" name="name" maxlength="255"></td></tr><tr><td width="150px"><b>Pristupové heslo:</b></td><td><input type="password" name="password" maxlength="255"></td></tr><tr><td width="150px"><b>Databáza:</b></td><td><input type="text" name="database" maxlength="255"></td></tr>', '<font>text. <br> text.</font>'];</script>
<select name="select" onchange="document.getElementById('text').innerHTML=texty[this.selectedIndex]">
<option value="1" selected>vybrať...</option>
<option value="2">text1</option>
<option value="3">text2</option>
</select>
<tr>
<td colspan="2" align="left"><p id=text></td>
</tr>
<tr>
<td colspan="2" align="center">
<hr><br>
<input type="hidden" value="2" name="step">
<input type="submit" value=">>" name="submit">
</form>
</td>
</tr>
</table>
</body>
</html>
<?php
break;
case 2:
print_r( $_POST );
break;
}
?>
print_r vracia pole:
Array ( [select] => 2 [step] => 2 [submit] => >> )
normalne vyberiem text1 a zadam do inputov udaje ale tie inputy su vzdy ako keby prec. su to len skusobne kody co som si na rychlo vytvoril podla mna su rovnake tak preco jeden ide druhy nie ?