Skip to content

Instantly share code, notes, and snippets.

@Sidsector9
Created January 9, 2017 17:15
Show Gist options
  • Select an option

  • Save Sidsector9/d472ceeed575644556a4478d02d347bf to your computer and use it in GitHub Desktop.

Select an option

Save Sidsector9/d472ceeed575644556a4478d02d347bf to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1><?php echo $_GET['username'] ?></h1>
<?php
$file = 'file.csv';
$handle = fopen( $file, 'r' );
?>
<?php if( isset( $_GET['username'] ) ) : ?>
<?php $value = $_GET['username'] ?>
<?php else : ?>
<?php $value = null; ?>
<?php endif; ?>
<form action="navi.php?username=<?php echo $value ?>" method="GET">
<select name="username" onchange="this.form.submit()">
<?php while ( $record = fgetcsv( $handle, 1000 ) ) : ?>
<option><?php echo $record[0] ?></option>
<?php endwhile; ?>
</select>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment