Jump to content

Insert select options into this code


daveyah2002
Go to solution Solved by Ch0cu3r,

Recommended Posts

  • Solution

There is nothing wrong with the code you posted.  Do you mean you want to save the output to the $photo_form variable instead of outputting it straight away?

 

You can change lines 13 - 18 to

$photo_form .=   $options;

Then define the options into the $options variable when you process your query results. Example

$sql = "SELECT DISTINCT gallery FROM photos WHERE user='$u'";
$query = mysqli_query($db_conx, $sql);
$options = '';
// process query. Define options into variable
while($option = $query->fetch_object())
{
	$options .= '<option>' . $option->gallery . '</option>';
}

.

 

Or just replace lines 13 to 18 with the following

// concatenate each option to $photo_form
while($option = $query->fetch_object())
{
	$photo_form .= '<option>' . $option->gallery . '</option>';
}
Edited by Ch0cu3r
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.