divinedesigns1 Posted July 9, 2015 Share Posted July 9, 2015 (edited) Ok, the code below is consist of 5 links (links are dynamically generated), which holds the values of 1, 2, 3, 4, 5 once click it gives out a value which is then divided by 2. i would like to turn this click into one link which either holds a random value which max is 5 or just a single value which would be one but imma keep that division by 2. (i think i figure it out, not sure tho) $getit = mysqli_query($con, "SELECT * FROM rate") or die('Error: ' . mysqli_error($con)); if($getit){ while($row = mysqli_fetch_assoc($getit)){ echo '<p>'; echo '<img style="width:300px; height:200px;" src="uploads/' . $row['id'] . '.' . $row['ext'] . '">'; echo '<p>'; for($x = 1; $x <= 5; $x++){ echo '<a href="rate.php?id=' . $row['id'] . '&rate=' . $x . '">' . $x . '</a>' . ' '; } echo 'Rate: ' . $row['total']; echo '</p>'; echo '</p>'; } } Edited July 9, 2015 by DDs1 Link to comment Share on other sites More sharing options...
thescientist Posted July 9, 2015 Share Posted July 9, 2015 I am having a hard time following along. I don't see any buttons. Do you mean the a tags (links)? And how exactly do you want five of those to become one? What exactly does that mean? Do you mean one link with just the rating inside it instead? Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 9, 2015 Author Share Posted July 9, 2015 I am having a hard time following along. I don't see any buttons. Do you mean the a tags (links)? And how exactly do you want five of those to become one? What exactly does that mean? Do you mean one link with just the rating inside it instead? yeah, the a tag is what im using as my button, and yeah im trying to have all those values which each a tag have to be in 1 tag which gives out either different values or just 1 value per click Link to comment Share on other sites More sharing options...
justsomeguy Posted July 9, 2015 Share Posted July 9, 2015 I also have no idea what you're talking about. If you only have 1 button then how does someone pick from 5 different ratings? Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 9, 2015 Author Share Posted July 9, 2015 I also have no idea what you're talking about. If you only have 1 button then how does someone pick from 5 different ratings? ok edit what i say Link to comment Share on other sites More sharing options...
divinedesigns1 Posted July 9, 2015 Author Share Posted July 9, 2015 woot woot, i actually figure it out, by making my statement here, i just needed to change one piece of code and rewrite the one important line of code for($x = 1; $x <= 5; $x++){ echo '<a href="rate.php?id=' . $row['id'] . '&rate=' . $x . '">' . $x . '</a>' . ' '; } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now