0

Hi,

I want to create script like in facebook.

When we log into facebook, go into any friend's profile

Their gift button , show gifts with pagination.
when click on image and ok button it save into database.

Any sample demo script ?
How to create script like this?

Please give me suggestions.

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Froger93
0

You could do this with radio buttons or JavaScript as facebook does.

Obviously we wont write this script for you but here is how it generally works.

<?php

// Run query to retreive gifts
$get_gifts = mysql_query("SELECT * FROM `gifts`");
if( @mysql_num_rows( $get_gifts ) > 0 ) {
echo "<form method=\"submit\" action=\"#\">";
while( $row = mysql_fetch_array( $get_gifts ) ) {
echo "<img src=\"...\" alt=\"...\" />" . $row['title'] . '<input type="radio" name="gift" value="' . $row['title'] . '" />';
}
echo '<input type="submit" name="send" value="Ok" />';
echo "</form>";
}

if( isset( $_POST['send'] ) ) {
$gift = mysql_real_escape_string( $gift );
// Need the user receiving the gifts id etc.
$user_id = "...";
$query = mysql_query("INSERT INTO `received_gifts` (id, gift) VALUES ('$user_id', '$gift')");
echo "<p>Gift sent</p>";
}

?>

Something allong those general lines.

Edited by Froger93: n/a

0

any demo sample example or script like facebook ?

Or sample link ??

0

Not that I know of the script above will do the same thing virtually just may need a little playing with.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.