/    Sign up×
Community /Pin to ProfileBookmark

problem with _POST

I am trying to pass a variable from a dynamic drop down menu. But the value is no being posted to script.php when I click submit. I have posted both pages of code. If any body sees what I am missing please let me know.

here is the page with the drop down and submit button.

[CODE]<?php
include “connect.php”;

$query=”SELECT * from strata_links order by name”;

$result=mysql_query($query) or die (“Unable to Make the Query:” . mysql_error() );

echo “<form name=’form1′ method=’post’ action=’script.php’>n”;

echo “<select name=’people’>n”;

while ($row = mysql_fetch_assoc($result))
{

echo “<option name=”option” value=”$row[name]”>$row[name]</option>n”;
//echo “<option value=’.$row[‘description’]’ name=’option’>{$row[‘description’]}</option>n”;
}
echo “</select>n”;

echo “<input type=’submit’ name=’submit’ value=’submit’>n”;

echo “</form>n”;

?> [/CODE]

Here is the script.php page that should echo the value of the posted variable.

[CODE]
<?
include “connect.php”;

if (isset($_POST[‘submit’])) // name of submit button
{
$choice=$_POST[‘option’];
echo “this is your choice”.$choice;
}
else{
print “<center>”;
print “<table>”;
print “<tr><td><center>please select a File first</center></td></tr>”;
print “<tr><td><center>”;
print “Wrong username or password or unactivated account, redirecting back to login page… <META HTTP-EQUIV = ‘Refresh’ Content = ‘2; URL =getimage.php’></center>”;
print “</td></tr></table></center>”;
}

?>[/CODE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@DenoteoneauthorJan 26.2008 — Solved
×

Success!

Help @Denoteone 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.8,
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,
)...