Skip to content

Commit

Permalink
Don't attempt to enter the same morpheme into the database twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
GPHemsley committed Nov 5, 2011
1 parent ce3eedf commit be0c324
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions inc/lib/lib.dictionary.php
Expand Up @@ -34,10 +34,11 @@ public function add_morpheme()

$submit = ( exists( $_POST['submit'] ) ) ? TRUE : FALSE;

$morpheme = ( exists( $_REQUEST['morpheme'] ) ) ? trim( $_REQUEST['morpheme'] ) : NULL;
$add_morpheme = ( exists( $_GET['morpheme'] ) ) ? trim( $_GET['morpheme'] ) : NULL;

if( $submit )
{
$morpheme = ( exists( $_POST['morpheme'] ) ) ? trim( $_POST['morpheme'] ) : NULL;
$gloss = ( exists( $_POST['gloss'] ) ) ? trim( $_POST['gloss'] ) : NULL;
$comments = ( exists( $_POST['comments'] ) ) ? trim( $_POST['comments'] ) : NULL;
// $morpheme_type = ( isset( $_POST['morpheme_type'] ) ) ? (int) $_POST['morpheme_type'] : GR_VAL_GOOD;
Expand Down Expand Up @@ -93,8 +94,8 @@ public function add_morpheme()
'label' => 'Morpheme',
'data' => array(
'size' => 30,
'autofocus' => ( ( !empty( $morpheme ) ) ? FALSE : TRUE ),
'value' => $morpheme,
'autofocus' => ( ( !empty( $add_morpheme ) ) ? FALSE : TRUE ),
'value' => $add_morpheme,
)
),
array(
Expand Down

0 comments on commit be0c324

Please sign in to comment.