Location: PHPKode > scripts > Check Active Comm-Ports Class > check-active-comm-ports-class/example.php
<?php

include('check_active_comm_port.class.php');

if(isset($_POST['comm'])) {

	if($_POST['comm']=='None') {
		echo 'There\'s no active comm-port that can be used. Please check the connection<br />
		(Right Click on My Computer->Select Properties->Hardware->Device Manager->Ports (COM & LPT))<br />
		If there is a comm-port is active, make sure that it is not being used';
	} else {
		echo 'Port = '.$_POST['comm'].'<br /> Baud Rate = '.$_POST['baud'];
	}


} else {

	$com = new windows_comm_port();
	$comm_list = $com->comm_list();
	$baud_list = $com->baud_list();

	$count = count($comm_list);
	$count2 = count($baud_list);

	echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
	Port <select name="comm">';
	for($i=0;$i<$count;$i++) {
		echo '<option value="'.$comm_list[$i].'">'.$comm_list[$i].'</option>';	
	}
	echo '</select> Baud Rate <select name="baud">';
	for($i=0;$i<$count2;$i++) {
		echo '<option value="'.$baud_list[$i].'">'.$baud_list[$i].'</option>';	
	}
	echo '</select> <input type="submit" value="Select" />
	</form>
	<hr />';

}

?>
Return current item: Check Active Comm-Ports Class