Ciao ho una pagina che permette una vista User risultati per un determinato torneo e rotondemodulo presentando con AJAX e PHP
utente selezionerà sport allora torneo è popolato basa sulla selezione sport allora UTENTE selezionare rotonda che è popolato in base alla selezione del torneo
Quando tutto è fatto utente preme il pulsante che cercare i risultati per il risultato sulla base di torneo e rotondo selezionato Invia
M codice y funziona grande:
mainPage.php
<script type="text/javascript">
$(document).ready(function()
{
$(".sport").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "get_sport.php",
dataType : 'html',
data: dataString,
cache: false,
success: function(html)
{
$(".tournament").html(html);
}
});
});
$(".tournament").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "get_round.php",
data: dataString,
cache: false,
success: function(html)
{
$(".round").html(html);
}
});
});
});
</script>
get_sport.php
<label>Sport :</label>
<form method="post">
<select name="sport" class="sport">
<option selected="selected">--Select Sport--</option>
<?php
$sql="SELECT distinct sport_type FROM events";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
?>
<option value="<?php echo $row['sport_type']; ?>"><?php echo $row['sport_type']; ?></option>
<?php
}
?>
</select>
<label>Tournamet :</label> <select name="tournament" class="tournament">
<option selected="selected">--Select Tournament--</option>
</select>
<label>Round :</label> <select name="round" class="round">
<option selected="selected">--Select Round--</option>
</select>
<input type="submit" value="View Picks" name="submit" />
</form>
get_round.php
if($_POST['id'])
{
$id=$_POST['id'];
$sql="SELECT DISTINCT round FROM events WHERE tournament='$id'";
$result=mysql_query($sql);
?>
<option selected="selected">Select Round</option><?php
while($row=mysql_fetch_array($result)){
?>
<option value="<?php echo $row['round'] ?>"><?php echo $row['round'] ?></option>
<?php
}
}
?>
ESEMPIO
Sport => Calcio; Torneo => EPL; Giro => 5;
Supponendo che quanto sopra è selezionata quando l'utente fa clic presentare il codice interrogherà select results from someTable Where sport='Football' AND...
mio problema
ottengo i dati delle caselle di selezione utilizzando un semplice php isset()
funzione
if(isset($_POST['submit'])){
echo $sport=$_POST['sport'];
echo $tour=$_POST['tournament'];
echo $round=$_POST['round'];
:
:
Ora il mio problema è quando inviare si fa clic su tutto funziona MA MA il modulo si ottiene eloaded, che è quello che non voglio
Im che cerca un equivalente AJAX di isset() o un modo per i dati da trasmettere senza la forma ricaricare
Qualsiasi idee/aiuto notevolmente sarà apprezzato
_ “Im alla ricerca di un equivalente AJAX di isset() "_ - non ha senso. – CBroe