/    Sign up×
Community /Pin to ProfileBookmark

5 Images from 100 text list

Hi everybody.

This is my first post – the usual plea for help I’m afraid – but hoping someone can point me in the right direction.

I have a form with a text list of 100 names and a folder with gfx sequentially numbered.

Its a cartoon thing – I want the end user to select their five favourites from the list and have them appear on a presentation page.

I know it can be done via a post. But new to PHP and not 100% clued up on variables.
On anything really for that matter. ?

Hope this makes a little sense.
Any advice would be very much appreciated.

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Feb 01.2007 — Where are the hundred names coming from? Are you coding them in manually in your script or from some other source?
Copy linkTweet thisAlerts:
@ShuggyauthorFeb 01.2007 — Hi, thanks for the reply!

The names are included in the form on the page itself.

I would use a dropdown gadget or buttons to click on - haven't decided on that yet.
Copy linkTweet thisAlerts:
@NightShift58Feb 01.2007 — It would make a difference...
Copy linkTweet thisAlerts:
@ShuggyauthorFeb 01.2007 — <SELECT NAME=choose_character>

<OPTION VALUE="avatar1">avatar1

<OPTION VALUE="avatar2">avatar2

<OPTION VALUE="avatar3">avatar3

<OPTION VALUE="avatar4">avatar4

<OPTION VALUE="avatar5">avatar5

</SELECT>

I think a drop-down box like this would suffice.
Copy linkTweet thisAlerts:
@hastxFeb 01.2007 — to simply take those choices an display them:

[code=php]
//gather the variables from the POST
$choose_character = $_POST['choose_character'];
$choose_character2 = $_POST['choose_character2'];//and so on
$ext = ".gif"; //whatever file type they are

//and then to display them:
echo "<img src="folder/$choose_character$ext">";
[/code]


or just embed them in the html:

[CODE]<img src="folder/<?=$choose_character.$ext ?>"><br>
<img src="folder/<?=$choose_character2.$ext ?>">
[/CODE]


you could also include the file extension in the value of your dropdown and avoid having to specify it here.
Copy linkTweet thisAlerts:
@NightShift58Feb 01.2007 — If you go the <SELECT> route, you want to do it as "MULTIPLE".

As user navigation assistance, you'll need some javascript validation to ensure that the user doesn't select more than 5 items and in the following page, you should validate again, with PHP, to preclude your script from processing if more than 5 items were selected (in case the user doesn't have javascript or somehow bypasses the javascript validatation).
Copy linkTweet thisAlerts:
@ShuggyauthorFeb 02.2007 — I got the form displaying images and a link to a numbered text file.

<?php

$choose_character = $_POST['avatar'];

$choose_character2 = $_
POST['avatar2'];

$ext = ".gif"; //image filetype

$myext = ".txt"; //textual filetype

echo "<img src="gfx/$choose_character$ext">";

echo "<A HREF="txt/$choose_character$myext">READ MORE</A>";

echo "<img src="gfx/$choose_character2$ext">";

echo "<A HREF="txt/$choose_character2$myext">READ MORE</A>";

?>

Its basic but a good start.

Thank you both for the help ?
×

Success!

Help @Shuggy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...