I have a page where the user adds events to the organization calendar.
They have a set order in which they want the fields to appear. About halfway through the form a drop down box selects the type of event. A second drop down box brings up a list of performers with that event type.
That part works fine using javascript. The reload wipes out all the form fields except event type. I have tried adding the other fields to the request along with type but not working.
$dynamo_q = "";
if(isset($_REQUEST['type']) && strlen($_REQUEST['type']) > 0)
{
$dynamo_q = sprintf("SELECT performer.gname, performer.perform_type, performer.p_id
FROM performer
WHERE performer.perform_type=" . $_REQUEST['type'] . "
ORDER BY performer.gname");
}else{
$dynamo_q = sprintf("SELECT performer.gname, performer.perform_type, performer.p_id
FROM performer
ORDER BY performer.gname");
}//end if isset check
$quer = mysql_query( $dynamo_q, $vendor) or die(mysql_error());
<script language="JavaScript" type="text/JavaScript">
function reload(formName){
var form = document.getElementById(formName);
var val = form.type.options[form.type.options.selectedIndex].value;
var markVal = form.market.options[form.market.options.selectedIndex].value;
var dateVal = form.date.options[form.date.options.selectedIndex].value;
var schedVal = form.sched.options[form.sched.options.selectedIndex].value;
self.location='add_eventTEST.php?type=' + val + '&market=' + markVal + '&date=' + dateVal +'&sched=' + schedVal;
}
</script>
</head>
<body bgcolor="#000000">
<?php include('../nav.txt'); ?>
<br>
<h2>Add an event </h2>
<form action="<?php echo $editFormAction; ?>" method="POST" name="addevent" id="addevent">
<p>Select Market
<?php if( isset($_REQUEST['market']))
{
while ($row_market = mysql_fetch_assoc($market)){
if( $row_market['mkt_id'] == $_REQUEST['market']){
//
echo $row_market['mkt']}
}
else{
?><select name="market" >
<?php
do {
?>
<option value="<?php echo $row_market['mkt_id']; ?>"><?php echo $row_market['mkt']; ?></option>
<?php
} while ($row_market = mysql_fetch_assoc($market));
$rows = mysql_num_rows($market);
if($rows > 0)
{
mysql_data_seek($market, 0);
$row_market = mysql_fetch_assoc($market);
}//end if
?>
</select>}
</p>
<p>Date:
<input type="text" name="date" id="date">
xxxx-xx-xx Time:
<select name="sched" id="sched">
<?php
do {
?>
<option value="<?php echo $row_sched['sched_id']; ?>"><?php echo $row_sched['sched']; ?></option>
<?php
} while ($row_sched = mysql_fetch_assoc($sched));
$rows = mysql_num_rows($sched);
if($rows > 0)
{
mysql_data_seek($sched, 0);
$row_sched = mysql_fetch_assoc($sched);
}//end if
?>
</select>
</p>
<p>Type of event:
<?php
echo " <select name='type' onchange=\"reload('addevent');\"><option value=''>Select one</option>";
while($noticia2 = mysql_fetch_assoc($ptype))
{
if( isset($_REQUEST['type']) && ($noticia2['typeid'] == $_REQUEST['type']) )
{
//perform_type.typeid, perform_type.type FROM perform_type ORDER BY perform_type.type";
echo "<option selected value='" . $noticia2['typeid'] . "'>" . $noticia2['type'] . "</option><BR>";
}else{
echo "<option value='" . $noticia2['typeid'] . "'>" . $noticia2['type'] . "</option>";
}//end if else set
}//end while
echo "</select>";
?>
</p>
<p>Add performer/event name:
<?php
echo "<select name='pevent'><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($quer))
{
echo "<option value='" . $noticia['p_id'] . "'>" . $noticia['gname'] . "</option>";
}//end while loop
problem part two is the user will want to add new performers to the list. A link takes them to an add_performer.php but when they return to the original form I want their other information to be there as well as the new performer added to the drop down.
Any assistance is welcomed. Been banging my head on this code far too long and hard.