Jump to content

[SOLVED] PHP in a form


maxudaskin

Recommended Posts

Would this be correct? The problem is that it shows up blank...

 

<?php
mysql_select_db($database_LeadHost, $LeadHost);
$result2 = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");
while($row2 = mysql_fetch_array($result2));
?>
                                      <input name="appid" type="text" id="appid" value="<?php echo $row2['apps'] ?>" />
                                      <input name="fname" type="text" id="fname" value="<?php echo $row2['fname'];?>" />
                                      <input name="lname" type="text" id="lname" value="<?php echo $row2['lname'];?>" />
                                      <input name="email" type="text" id="email" value="<?php echo $row2['email'];?>" />
                                      <input name="pass" type="text" id="pass" value="<?php echo $row2['pass'];?>" />
                                      <input name="hub" type="text" id="hub" value="<?php echo $row2['hub'];?>" />
                                      <input name="position" type="text" id="position" value="<?php echo $row2['position'];?>" />
                                      <input name="appdate" type="text" id="appdate" value="<?php echo $row2['appdate'];?>" />
                                      <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="birthday" type="text" id="birthday" value="<?php echo $row2['birthday'];?>" />
                                      <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="vatsim" type="text" id="vatsim" value="<?php echo $row2['vatsim'];?>" />
                                      <input name="ivao" type="text" id="ivao" value="<?php echo $row2['ivao'];?>" />
                                      <input name="ip" type="text" id="ip" value="<?php echo $row2['ip'];?>" />
</div></td>
                                    </tr>
                                  </table>
                                  <br />
                                  <input name="accept" type="submit" class="buttons" id="accept" value="Accept" />
                                </div>
                            </form>

Link to comment
Share on other sites

Try this:

 

<?php
mysql_select_db($database_LeadHost, $LeadHost);
$result2 = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");

if (mysql_num_rows($result2) > 0) {
    
    while ($row2 = mysql_fetch_array($result2)) {
        
        ?>
        <input name="appid" type="text" id="appid" value="<?php echo $row2['apps'] ?>" />
        <input name="fname" type="text" id="fname" value="<?php echo $row2['fname'];?>" />
        <input name="lname" type="text" id="lname" value="<?php echo $row2['lname'];?>" />
        <input name="email" type="text" id="email" value="<?php echo $row2['email'];?>" />
        <input name="pass" type="text" id="pass" value="<?php echo $row2['pass'];?>" />
        <input name="hub" type="text" id="hub" value="<?php echo $row2['hub'];?>" />
        <input name="position" type="text" id="position" value="<?php echo $row2['position'];?>" />
        <input name="appdate" type="text" id="appdate" value="<?php echo $row2['appdate'];?>" />
        <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
        <input name="birthday" type="text" id="birthday" value="<?php echo $row2['birthday'];?>" />
        <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
        <input name="vatsim" type="text" id="vatsim" value="<?php echo $row2['vatsim'];?>" />
        <input name="ivao" type="text" id="ivao" value="<?php echo $row2['ivao'];?>" />
        <input name="ip" type="text" id="ip" value="<?php echo $row2['ip'];?>" />
        </div></td>
        </tr>
        </table>
        <br />
        <input name="accept" type="submit" class="buttons" id="accept" value="Accept" />
        </div>
        </form>
        
<?php
    }
} else {
    echo "No results in Database";
}
?>

 

I also don't see where you have $id defined...so you might want to double check that.

Link to comment
Share on other sites

Here is the whole script... (UNNESSESARY HTML EDITED OUT)

 

php require('Connections/LeadHost.php'); ?>
<?php
mysql_select_db($database_LeadHost, $LeadHost);
$query_Recordset1 = "SELECT * FROM applications ORDER BY id ASC";
$Recordset1 = mysql_query($query_Recordset1, $LeadHost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

Html Visual Code

<div align="center">                              Select User from the Drop Down Menu Below                            <br />
                            </div>
                            <form id="user" name="user" method="get" action="<?=$PHP_SELF; ?>">
                                
                                  <div align="center">
                                    <select name="apps" class="dropdown">
                                      <option value="0" <?php if (!(strcmp(0, $row_Recordset1['id']))) {echo "selected=\"selected\"";} ?>>Select One</option>
                                      <?php
do {  
?>
                                      <option value="<?php echo $row_Recordset1['id']?>"<?php if (!(strcmp($row_Recordset1['id'], $row_Recordset1['id']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset1['lname']?></option>
                                      <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
                                    </select>
                                    <br />
                                    <br />
                                    <input name="Submit" type="submit" class="buttons" value="View Applicant" />
                                    <br />
                                    </div>
                            </form>
                            <div align="left">
                              <?php
$id = $_GET['apps'];
$result = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");
if($_GET["Submit"])
{
while($row = mysql_fetch_array($result))
  {
  echo $row['fname'] . " " . $row['lname'];
  echo "<br />";
  echo "<br />";?>
<strong> Email </strong><br />
<?php
  echo $row['email'] . " | " . $row['emailver'];
  echo "<br />";
  echo "<br />";
?>
<strong> Password </strong><br />
<?php
  echo $row['pass'] . " | " . $row['passver'];
  echo "<br />";
  echo "<br />";
?><strong> Hub </strong><br />
<?php
  echo $row['hub'];
  echo "<br />";
  echo "<br />";
?><strong> Country </strong><br />
<?php
  echo $row['country'];
  echo "<br />";
  echo "<br />";
?><strong> Birthday (DD/MM/YYYY) </strong><br />
<?php
  echo $row['birthday'];
  echo "<br />";
  echo "<br />";
?><strong> Vatsim ID </strong><br />
<?php
  echo $row['vatsim'];
  echo "<br />";
  echo "<br />";
?><strong> Internation Virtual Aviation Organisation ID (IVAO) </strong><br />
<?php
  echo $row['ivao'];
  echo "<br />";
  echo "<br />";
?><strong> Position </strong><br />
<?php
  echo $row['position'];
  echo "<br />";
  echo "<br />";
?><strong> Resumé </strong><br />
<?php
  echo $row['reason'];
  echo "<br />";
  echo "<br />";
?><strong> Submission Date </strong><br />
<?php
  echo $row['appdate'];
  echo "<br />";
  echo "<br />";
?><strong> IP Address </strong><br />
<?php
  echo $row['ip'];
  echo "<br />";
  echo "<br />";
  }
?>
                            </div>
                            <form id="goback" name="adduser" method="post" action="adduser.php">
  
                                <div align="center">
                                  <table width="210" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                      <td width="210"><div align="left">
                                        <select name="role" id="role">
                                          <option value="0">Pilot</option>
                                          <option value="1">Staff</option>
                                        </select>
                                        Access Restrictions<br />
                                          <select name="hub" id="hub">
                                            <option value="1000">YYZ</option>
                                            <option value="2000">YVR</option>
                                            <option value="3000">LHR</option>
                                              </select>
Hub<br />
<?php
mysql_select_db($database_LeadHost, $LeadHost);
$result2 = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");
while($row2 = mysql_fetch_array($result2));
?>
                                      <input name="appid" type="text" id="appid" value="<?php echo $row2['apps'] ?>" />
                                      <input name="fname" type="text" id="fname" value="<?php echo $row2['fname'];?>" />
                                      <input name="lname" type="text" id="lname" value="<?php echo $row2['lname'];?>" />
                                      <input name="email" type="text" id="email" value="<?php echo $row2['email'];?>" />
                                      <input name="pass" type="text" id="pass" value="<?php echo $row2['pass'];?>" />
                                      <input name="hub" type="text" id="hub" value="<?php echo $row2['hub'];?>" />
                                      <input name="position" type="text" id="position" value="<?php echo $row2['position'];?>" />
                                      <input name="appdate" type="text" id="appdate" value="<?php echo $row2['appdate'];?>" />
                                      <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="birthday" type="text" id="birthday" value="<?php echo $row2['birthday'];?>" />
                                      <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
                                      <input name="vatsim" type="text" id="vatsim" value="<?php echo $row2['vatsim'];?>" />
                                      <input name="ivao" type="text" id="ivao" value="<?php echo $row2['ivao'];?>" />
                                      <input name="ip" type="text" id="ip" value="<?php echo $row2['ip'];?>" />
</div></td>
                                    </tr>
                                  </table>
                                  <br />
                                  <input name="accept" type="submit" class="buttons" id="accept" value="Accept" />
                                </div>
                            </form>
                            <div align="left">
                              <?php
}

?>

Link to comment
Share on other sites

Try this:

 

<?php
mysql_select_db($database_LeadHost, $LeadHost);
$result2 = mysql_query("SELECT * FROM `applications` WHERE `id`='{$id}'");

if (mysql_num_rows($result2) > 0) {
    
    while ($row2 = mysql_fetch_array($result2)) {
        
        ?>
        <input name="appid" type="text" id="appid" value="<?php echo $row2['apps'] ?>" />
        <input name="fname" type="text" id="fname" value="<?php echo $row2['fname'];?>" />
        <input name="lname" type="text" id="lname" value="<?php echo $row2['lname'];?>" />
        <input name="email" type="text" id="email" value="<?php echo $row2['email'];?>" />
        <input name="pass" type="text" id="pass" value="<?php echo $row2['pass'];?>" />
        <input name="hub" type="text" id="hub" value="<?php echo $row2['hub'];?>" />
        <input name="position" type="text" id="position" value="<?php echo $row2['position'];?>" />
        <input name="appdate" type="text" id="appdate" value="<?php echo $row2['appdate'];?>" />
        <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
        <input name="birthday" type="text" id="birthday" value="<?php echo $row2['birthday'];?>" />
        <input name="country" type="text" id="country" value="<?php echo $row2['country'];?>" />
        <input name="vatsim" type="text" id="vatsim" value="<?php echo $row2['vatsim'];?>" />
        <input name="ivao" type="text" id="ivao" value="<?php echo $row2['ivao'];?>" />
        <input name="ip" type="text" id="ip" value="<?php echo $row2['ip'];?>" />
        </div></td>
        </tr>
        </table>
        <br />
        <input name="accept" type="submit" class="buttons" id="accept" value="Accept" />
        </div>
        </form>
        
<?php
    }
} else {
    echo "No results in Database";
}
?>

 

I also don't see where you have $id defined...so you might want to double check that.

Wow... I Wish you were my brother...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.