/    Sign up×
Community /Pin to ProfileBookmark

newbie(making out for database)

hi guys

can you help me out here..coz im not yet familiar with php..i just want to know how can i make a database out of php..as shown in my illustration..i want to combine the data for height,body figure, skin tone, and dress code in the empty field above..when i click the submit button the combine data will appear on the white space above..please help me..

[upl-file uuid=7d025942-a0f4-4691-9136-edfdb9f19a28 size=47kB]illustration.JPG[/upl-file]

to post a comment
PHP

13 Comments(s)

Copy linkTweet thisAlerts:
@Sid3335Jul 30.2006 — This would not require a database unless the values for your select boxes were to be populated from one.

you would simply have the form post back to itself:

[code=html]
<form method="post" action="page_name.php">
[/code]


then use:
[code=php]
$height = $_POST['select_name'] ;
$weight = $_POST['select_name'] ;
etc
[/code]


this will retrieve the form input data.

after that just echo/print back the variables to the user.

thats how i would do it anyway. hope it helps.
Copy linkTweet thisAlerts:
@cezame1123authorJul 31.2006 — thanks sid ill try it right away..
Copy linkTweet thisAlerts:
@cezame1123authorJul 31.2006 — will i change the 'select_name'?what should i input in the 'select_name'?so do i need to install mysql?
Copy linkTweet thisAlerts:
@Sid3335Jul 31.2006 — you do not need mysql unless you want to store or retreive values for this script, do you?

select_name should be the name of the select element

so if your height select is named like this:

[code=html]
<select name="height_select">
[/code]


you will retrieve the value for height like:
[code=php]
$height = $_POST['height_select'] ;
[/code]


remember though the options within a select have two properties:

value

label

$_POST['height_select'] ;

will return the value, not the label.
Copy linkTweet thisAlerts:
@cezame1123authorJul 31.2006 — thank you so much...
Copy linkTweet thisAlerts:
@cezame1123authorJul 31.2006 — hi sid again,

how can i put the data? i mean how can i make a data out of this choices? for example the height=tall (taller guys are more bright than the short one etc.?)<---data......and how to make the data viewable on the text area above it?

thanks again sid..
Copy linkTweet thisAlerts:
@Sid3335Aug 01.2006 — here you go:

[code=php]
<?php
$height = $_POST['height_select'] ;
$figure = $_POST['figure_select'] ;
$tone = $_POST['tone_select'] ;
$code = $_POST['code_select'] ;
?>
<html>
<head>
</head>
<body>
<form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'] ; ?>">
<table width="500" border="1">
<tr>
<td height="200" colspan="2" align="left" valign="top">&nbsp;
<?php

echo "returned values:<br>" ;
echo "height: " . $height . "<br>" ;
echo "figure: " . $figure . "<br>" ;
echo "tone: " . $tone . "<br>" ;
echo "code: " . $code . "<br>" ;

switch ($height)
{
case 'tall':
{
echo "taller guys are more bright than the short one etc<br>" ;
break ;
}
case 'short':
{
echo "short guys are less bright than the tall one etc<br>" ;
break ;
}
case 'average':
{
echo "average guys are...........errrrr..........average etc<br>" ;
break ;
}
}

?>
</td>
</tr>
<tr>
<td>height</td>
<td><select name="height_select" id="height_select">
<option value="tall">tall</option>
<option value="short">short</option>
<option value="average" selected="selected">average</option>
</select></td>
</tr>
<tr>
<td>figure</td>
<td><select name="figure_select" id="figure_select">
<option value="fat">fat</option>
<option value="thin">thin</option>
<option value="average" selected="selected">average</option>
</select></td>
</tr>
<tr>
<td>tone</td>
<td><select name="tone_select" id="tone_select">
<option value="tan" selected="selected">tan</option>
<option value="dark">dark</option>
<option value="casper">casper</option>
</select></td>
</tr>
<tr>
<td>code</td>
<td><select name="code_select" id="code_select">
<option value="summer" selected="selected">summer</option>
<option value="winter">winter</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
[/code]
Copy linkTweet thisAlerts:
@cezame1123authorAug 01.2006 — thanks sid..really appreciate your concern..
Copy linkTweet thisAlerts:
@cezame1123authorAug 01.2006 — thanks again..it works..
Copy linkTweet thisAlerts:
@cezame1123authorAug 04.2006 — hi sid

thanks again for last time..but i have an another problem..can you check my work on my attach file?i cant figure out what seems wrong?

[upl-file uuid=f7a55d27-a767-4469-b972-4da87d1a2d17 size=10kB]1.txt[/upl-file]
Copy linkTweet thisAlerts:
@Sid3335Aug 04.2006 — you are missing a closing brace } on every switch statement. (except the last one)

so just make sure you are closing them before starting the next one.

i checked it, it runs fine.
Copy linkTweet thisAlerts:
@cezame1123authorAug 05.2006 — thanks again didnt notice that..
Copy linkTweet thisAlerts:
@cezame1123authorAug 05.2006 — how can i allow null ing php?can you show me from the illustration i uploaded earlier?
×

Success!

Help @cezame1123 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.24,
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,
)...