Jump to content

Action depending on drop down selection


gnawz

Recommended Posts

these are my files

 

reports.php

 

$Report = $_GET['report'];

 

switch ($Report)

{

 

case 'add' :

 

addfunction();

 

break;

 

case 'delete' :

 

deletefunction();

 

break;

 

case 'update' :

 

updatefunction();

 

break;

}

 

 

the other file with my select...

 

checkrpt.php

 

<form name="frmUtils" method="post" action="">

 

  <select name="Do"  id ="Do"onChange="SwapReport();">

        <option value="0">Select view</option>

        <option value="1">Add</option>

        <option value="2">Update</option>

<option value="2">Delete</option>

      </select>

    </form>

 

 

<script type="text/javascript">

 

function SwapReport()

{

if (document.frmUtils.Do.selectedIndex == 1)

{

document.frmUtils.action = "reports.php?report=add";

}

else if (document.frmUtils.Do.selectedIndex == 2)

{

document.frmUtils.action = "reports.php?report=update";

}

else (document.frmUtils.Do.selectedIndex == 3)

{

document.frmUtils.action = "reports.php?report=delete";

}

 

}

</script>

 

Help from here.  It is not working yet.

Link to comment
https://forums.phpfreaks.com/topic/61518-action-depending-on-drop-down-selection/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.