radio form submission
| From: | Chris Stinemetz | Date: | Thu, 23 Jun 2011 18:18:52 +0000 |
| Subject: | radio form submission | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-47868@lists.php.net to get a copy of this message | ||
So far I am good on creating the form and submitting it to mysql
database and calling the submitting value from a different script.
My question is: How can I make it so when a user selects radio option
value "1" it will then be displayed as 0-250kbps when I call it the
value in the bottom script?
forgive my indention. Gmail messes it up.
#### My Form ####
echo '<form method="post" action="">
Store name: <input type="text" name="store_subject" /><br
/><br />
Market:';
echo '<select name="store_mar">';
while($row = mysql_fetch_assoc($result))
{
echo '<option value="' . $row['mar_id'] . '">' .
$row['mar_name'] . '</option>';
}
echo '</select><br /><br />';
echo 'Broadband speed test results: <br /><br />
0-250kbps<input type="radio" name="post_tptest" value="1"
/>|
250-300kbps<input type="radio" name="post_tptest" value="2"
/>|
300-400kbps<input type="radio" name="post_tptest" value="3"
/>|
400-600kbps<input type="radio" name="post_tptest" value="4"
/>|
600kbps-3.8mbps<input type="radio" name="post_tptest"
value="5"
/><br /><br />
Store visit details: <br /><br />
<textarea name="post_content" /></textarea><br /><br />
<input type="submit" value="Add a store visit" />
</form>';
#### My display script ####
$posts_sql = "SELECT
posts.post_store,
posts.post_content,
posts.post_tptest,
posts.post_date,
posts.post_by,
users.user_id,
users.user_name,
users.first_name,
users.last_name
FROM
posts
LEFT JOIN
users
ON
posts.post_by = users.user_id
WHERE
posts.post_store = " . mysql_real_escape_string($_GET['id']) . "
ORDER BY
posts.post_date DESC ";
$posts_result = mysql_query($posts_sql);
if(!$posts_result)
{
echo '<tr><td>The posts could not be displayed, please try again
later.</tr></td></table>';
}
else
{
while($posts_row = mysql_fetch_assoc($posts_result))
{
echo '<tr class="topic-post">
<td class="user-post">' . $posts_row['first_name'] . '
' .
$posts_row['last_name'] . '<br/>' . date('m-d-Y h:iA',
strtotime($posts_row['post_date'])) . '</td>
<td class="post-content">' . $posts_row['post_tptest'] .
'<br/>' . htmlentities(stripslashes($posts_row['post_content'])) .
'</td>
</tr>';
}
}