If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Member #

    I have a poll form as below, called display_poll.php, that I will display at a small section of my whole page. The form sends all the data to another page called update_answers.php, which updtaes the database with the response and displays vote results. it works out fine, but update_answers page is displayed as a separate page... what i want is, when the user hits submit, I want this to be displayed in the same location of the poll, at the same location where i displayed my poll questions, and not as a separate page as right now. How to do that? I am assuming that instead of saying action=update answer" i ned to say something else, but i dont know what..

    echo "<form method=\"post\" action=\"update_answers.php\">";


  3. #2
    Senior Member
    Join Date
    May 2003
    Member #
    You can have the form submit to the page itself, and then use some logic to check to see if the form is submitted.

    If not, display the form. Else: Display thanks message/whatever.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="" xml:lang="en" lang="en">
    	<title>PHP POll example</title>
    	<meta http-equiv="content-type" content="text/html;charset=utf-8" />
    	<h1>Web page title</h1>
    	<p id="description">This is a poll... Lorem ipsum</p>
    	<div id="poll">
    	if(isset($_POST['submit']) == false)
    	{ ?>
    		<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    			<p>How good is beer?</p>
    			<input type="radio" name="beer" value="good" /> Good
    			<input type="radio" name="beer" value="average" /> Average
    			<input type="radio" name="beer" value="poor" /> Poor
    			<input type="submit" name="submit" value="Vote" />
    	{ ?>
    		<p>You subbmited the form.</p>

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 09:43 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: