jan-vandenberg / cruddiy

No-code Bootstrap PHP CRUD generator
http://cruddiy.com
GNU Affero General Public License v3.0
253 stars 80 forks source link

Undefined server variables in index #37

Closed apmuthu closed 2 years ago

apmuthu commented 3 years ago

When we start cruddiy for generating the application, the MySQL server parameters are not defined and hence we get errors for missing variables.

The fix is:

--- index.php   Fri Aug 06 06:32:00 2021
+++ index.php   Mon Aug 30 22:59:39 2021
@@ -31,30 +31,30 @@
                     <!-- Text input-->
                     <div class="form-group">
                         <label class="col-form-label" for="textinput">Server</label>
-                        <input id="server" name="server" type="text" placeholder="localhost" class="form-control " value="<?php echo $db_server; ?>">
+                        <input id="server" name="server" type="text" placeholder="localhost" class="form-control " value="<?php if(isset($db_server)) echo $db_server; ?>">
                     </div>

                     <!-- Text input-->
                     <div class="form-group">
                         <label class="col-form-label" for="textinput">Database</label>
-                        <input id="database" name="database" type="text" placeholder="" class="form-control input-md" value="<?php echo $db_name; ?>">
+                        <input id="database" name="database" type="text" placeholder="" class="form-control input-md" value="<?php if(isset($db_name)) echo $db_name; ?>">
                     </div>
                     <!-- Text input-->
                     <div class="form-group">
                         <label class="col-form-label" for="textinput">Username</label>
-                        <input id="username" name="username" type="text" placeholder="" class="form-control input-md" value="<?php echo $db_user; ?>">
+                        <input id="username" name="username" type="text" placeholder="" class="form-control input-md" value="<?php if(isset($db_user)) echo $db_user; ?>">
                     </div>

                     <!-- Password input-->
                     <div class="form-group">
                         <label class="col-form-label" for="passwordinput">Password</label>
-                        <input id="password" name="password" type="password" placeholder="" class="form-control input-md" value="<?php echo $db_password; ?>">
+                        <input id="password" name="password" type="password" placeholder="" class="form-control input-md" value="<?php if(isset($db_password)) echo $db_password; ?>">
                     </div>

                     <!-- Number records per page-->
                     <div class="form-group">
                         <label class="col-form-label" for="recordsperpage">Items per generated page</label>
-                        <input id="numrecordsperpage" name="numrecordsperpage" type="number" min="1" max="1000" placeholder="Number of items per page" class="form-control input-md" value="10" value="<?php echo $no_of_records_per_page ?>">
+                        <input id="numrecordsperpage" name="numrecordsperpage" type="number" min="1" max="1000" placeholder="Number of items per page" class="form-control input-md" value="10" value="<?php if(isset($no_of_records_per_page)) echo $no_of_records_per_page ?>">
                     </div>
jan-vandenberg commented 3 years ago

Ok! Can you make a PR?

jan-vandenberg commented 2 years ago

Fixed in https://github.com/jan-vandenberg/cruddiy/commit/b6eeef66366a9be83e23b717bb706bd3115488cd

Thanks!