jjmusicpro Posted October 2, 2007 Share Posted October 2, 2007 just curious, how do i get the values from a query from a db into text box's, in a form, so i can hit submit and it goes to an "update" page? <?php if (isset($_POST['update'])){ echo "<p>Error, please try again"; } else { require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM zipcodes WHERE search_id='$zip_id'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupid_sent= $row['account_name'] ; $account_name= $row['company_name'] ; $zip_id = $row['search_id'] ; $zipcode = $row['zipcode']; echo "Edit Zip Code <b>$zipcode</b> for $account_name"; echo "<form>"; echo "test data"; echo "</form>"; } } Quote Link to comment Share on other sites More sharing options...
thunder708 Posted August 12, 2009 Share Posted August 12, 2009 this is how you would do it if you are writing the form within the php tags echo "<form>"; echo "<input type='text' name='groupid' value='".$groupid_sent."'>"; echo "<input type='text' name='account_name' value='".$account_name."'>"; echo "<input type='text' name='zipid' value='".$zip_id."'>"; echo "<input type='text' name='zipcode' value='".$zipcode."'>"; echo "</form>"; if you decide to close the tags after this line: echo "Edit Zip Code <b>$zipcode</b> for $account_name"; you will need to do this: echo "Edit Zip Code <b>$zipcode</b> for $account_name"; ?> <form> <input type="text" name="groupid" value="<? echo $groupid_sent; ?>"> <input type="text" name="account_name" value="<? echo $account_name; ?>"> <input type="text" name="zipid" value="<? echo $zip_id; ?>"> <input type="text" name="zipcode" value="<? echo $zipcode; ?>"> </form> <? // rest of php code.... hope this helps Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.