<?php

    $card = $use->getRowById('cards',$_GET['id']);

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

		if($use->update_card($_POST,$_GET['id'])){
			echo "<script>location='./?page=cards&message=Card has been updated successfully'</script>";
		}else{
			echo "<script>location='./?page=cards&message=Try again later!'</script>";
		}
	}
?>
<div class="row">

    <div class="col-md-12">

        <div class="card">

            <div class="card-header bg-transparent">

                <div class="row align-items-center">

                    <div class="col">

                        <h6 class="text-uppercase text-muted ls-1 mb-1">Update Card</h6>

                    </div>

                </div>
				
            </div>

            <div class="card-body">

                <form action="" method="post" enctype="multipart/form-data">

                    <div class="form-group mb-3">

                        <label for="">Name</label>

                        <input type="text" name="Name" value="<?= ucwords(str_replace('-',' ',$card['slug'])) ?>" readonly class="form-control">

                    </div>

                    <div class="form-group mb-3">

                        <label for="">General Link</label>

                        <input type="text" name="general" class="form-control" value="<?= $card['general'] ?>">

                    </div>

                    <div class="form-group mb-3">

                        <label for="">Love Link</label>

                        <input type="text" name="love" class="form-control" value="<?= $card['love'] ?>">

                    </div>
					
					<div class="form-group mb-3">

                        <label for="">Finance Link</label>

                        <input type="text" name="finance" class="form-control" value="<?= $card['finance'] ?>">

                    </div>
					
					<div class="form-group mb-3">

                        <label for="">Health Link</label>

                        <input type="text" name="health" class="form-control" value="<?= $card['health'] ?>">

                    </div>

                    <button type="submit" name="submit" class="btn btn-success">Update</button>

                </form>

            </div>

        </div>

    </div>

</div>