Author Topic: dynamic css image sliding in php  (Read 180 times)

NancyG

  • New Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
dynamic css image sliding in php
« on: February 02, 2012, 07:34:09 PM »
hello,

I am a beginner in php so looking for your precious suggestions.

I am looking to do this http://www.impressivewebs.com/demo-files/content-switcher/content-switcher.html#one
dynamically in php.

Basically I am retrieving three pirctures from database and looking to do this dynamically, I am badly stuck, so will be glad to get help.

Thank you.

plintu

  • freelance programmer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 246
  • Karma: +5/-0
    • View Profile
    • plintu.com
Re: dynamic css image sliding in php
« Reply #1 on: February 02, 2012, 08:18:37 PM »
doing it in php would basically be just using linked images, you could add some GET info to the links such as :

index.php?id=1

then in php you do something like:


PHP Code: [Select]


if($_GET==1){ echo"<img src={$variable_from_database_call}"; }


php would not be all to pretty for something like that, it would have to refresh the page in order to show change, where as you should use javascript or jquery to do some dynamic changes without refreshing the page


Find an affordable programmer, contact me :D

NancyG

  • New Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: dynamic css image sliding in php
« Reply #2 on: February 02, 2012, 08:26:40 PM »
Thanks for your reply, basically it is to get votes from user on an image and I am doing like this:


Code: [Select]
<form method="post" action="vote_frame.php" >

<div id="content-slider">

<ul id="content-slider-inside">

<?php 
$q 
mysql_query("SELECT * FROM vote_frames");
while ( 
$r mysql_fetch_array($q) ) { ?>



<li>

<input type="hidden" name="frame_id" value="<?php echo $r["frame_id"]; ?>" />

<img src="frame_thumbs/<?php echo $r["frame_pic"]; ?>" /> <br />

</li>



<input type="radio" name="vote" value="1"> Vote This Frame <br />

<input type="image" src="image/vote-btn.jpg" BORDER="0" ALT="SUBMIT!" >

<?php ?>

</ul>

</div>

</form>

Records are fetched, they are ok, Now I need to print counting links associated with the fetched image, so if some one clicks on 2, 2nd record is selected like it does in html.

NancyG

  • New Member
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: dynamic css image sliding in php
« Reply #3 on: February 03, 2012, 05:41:14 PM »
Ok, I finally did this, now its voting issue, Here is code which did job for me

Code:
<form method="post" action="vote_frame.php" >

<div id="content-slider">

<ul id="content-slider-inside">

<?php
$q = mysql_query("SELECT * FROM vote_frames");
while ( $r = mysql_fetch_array($q) ) {

?>

<input type="hidden" name="frame_id" value="<?php echo $r["frame_id"]; ?>" />

<li id="<?php echo $r["frame_id"]; ?>">

<img src="frame_thumbs/<?php echo $r["frame_pic"]; ?>" />

</li>

<input type="radio" name="vote" value="1"> Vote This Frame (#<?php echo $r["frame_name"]; ?>) <br />

<input type="image" src="image/vote-btn.jpg" BORDER="0" ALT="SUBMIT!" >

<?php } ?>

</ul>

<ul id="navigation">

<?php

$q = "select * from vote_frames";

$result = mysql_query($q);

$frameCount = 1;

while($row=mysql_fetch_array($result))
{ ?>
<li><a href="#<?php echo $row["frame_id"];?>"> <?php echo $frameCount ++; ?> </a></li>
<?php } ?>

</ul>

</div>

</form>


Now, the only issue remains is the voting. Vote goes to the frame with having highest ID even 1st, 2nd or 3rd record is selected. How to over come this now?