I Got It.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks a million for the help. I did not change the php.ini file, what I did
wuz rework your code so that I got a clearer understanding. So not only did
I learn, but I manage to solve my problem. Once again. Thank you

Nik


"Robin Stoker" <robins@porteighty.co.za> wrote in message
003001c3b392$370aaef0$2a6eef9b@magiclaptop">news:003001c3b392$370aaef0$2a6eef9b@magiclaptop...
>
> Hey Nik
>
> This is very strange, and the only thing I can think of is that it may
> be your php config. I assume you are using php 4.2.3 or higher? and the
> only time I ever had problems with posting values was with the
> register_globals option in the php.ini file.
>
> I don't know if you know anything about this but when I was having
> problems, I simply enabled this option and everything came together. I
> know they say that it is a security risk, however, if you refer to
> posted values using the $_POST variable, you should be o.k
>
> Hope this helps
> - Robin
>
> -----Original Message-----
> From: Nik [mailto:nik@guyanachronicle.com]
> Sent: 25 November 2003 07:41 PM
> To: php-windows@lists.php.net
> Subject: Re:  Online Polls
>
> I understand what you did and how you did it. However, the values within
> the
> variables on the vote.php page are not being passed to regvote.php page.
> I
> know this because I tried testing it. Below is just one of the examples
> that
> i used to test it.
>
> <?PHP
>  //Register User Vote - regvote.php
>
>  include 'config.inc.php';
>  include 'dbconnect.inc.php';
>
>   $test = $_POST['poll_id'];
>   echo $test;
> ?>
>
>
> "Robin Stoker" <robins@porteighty.co.za> wrote in message
> 000001c3b2de$adb54dd0$756fef9b@magiclaptop">news:000001c3b2de$adb54dd0$756fef9b@magiclaptop...
> >
> > Hey Nik
> >
> > Try this little piece of code (I've put in a few tips to help you with
> > your website coding):
> >
> >
> ========================================================================
> > =====================================
> > // config.inc.php
> > // here you can put website config options
> > // such as database config details
> > // this file, as well as the dbconnect.inc.php file, will be
> "included"
> > in the rest of the scripts
> > // by doing it this way, if any of your database connection details
> > change, then you only have to
> > // change them in one place, the config.inc.php file, instead of
> > changing every single one of your scripts!
> >
> > <?php
> >
> >  $db_host = 'localhost';
> >  $db_user = 'freaknik';
> >  $db_password = '';
> >  $db = 'survey';
> >
> > ?>
> >
> > // end config.inc.php
> >
> ========================================================================
> > =====================================
> >
> >
> > // dbconnect.inc.php
> > // this script will connect to the db
> >
> > <?
> >
> >  $db_srv_conn = mysql_pconnect($dbhost,$db_user,$db_password)
> >       or die("Could not connect to the server");
> >
> >  $db_conn = mysql_select_db($db,$db_srv_conn)
> >               or die("Could not connect to the database");
> >
> > ?>
> >
> > // end dbconnect.inc.php
> >
> ========================================================================
> > =====================================
> >
> > // vote.php
> > // this is the form used for voting
> > <?php
> >
> >  include 'config.inc.php';
> >  include 'dbconnect.inc.php';
> >
> >  $getpollquery = "SELECT * FROM poll ORDER BY date DESC"; // THIS WILL
> > GET THE LATEST POLL FROM THE DATABASE
> >  $getpollquery_handle = mysql_query($getpollquery);
> >  $getpollquery_result = mysql_fetch_row($getpollquery_handle)
> >
> > ?>
> >
> > <form method="POST" action="regvote.php">
> >   <p>
> >   <?php echo $getpollquery_result[1]; ?></p>
> >   <p><input type="radio" name="R1" value="response1" checked><?php
> echo
> > $getpollquery_result[2]; ?></p>
> >   <p><input type="radio" name="R1" value="response2"><?php echo
> > $getpollquery_result[3]; ?></p>
> >   <p><input type="radio" name="R1" value="response3"><?php echo
> > $getpollquery_result[4]; ?></p>
> >      <input type="hidden" name="poll_id" value="<?php echo
> > $getpollquery_result[0]; ?>">
> >   <p><input type="submit" value="Submit" name="submit"></p>
> > </form>
> >
> > // end vote.php
> >
> ========================================================================
> > =====================================
> >
> > // regvote.php
> > // this is to process the form and insert data into the database
> >
> > <?php
> >
> >  include 'config.inc.php';
> >  include 'dbconnect.inc.php';
> >
> > if (array_key_exists("R1", $_POST)) {
> >
> > switch ($_POST['R1']) { // check which option
> > was selected and create sql query
> > case "response1":
> >
> > $updatequery = "UPDATE poll SET votes1 WHERE
> > id=".$_POST['poll_id'];
> >
> > case "response2":
> >
> > $updatequery = "UPDATE poll SET votes2 WHERE
> > id=".$_POST['poll_id'];
> >
> > case "response3":
> >
> > $updatequery = "UPDATE poll SET votes3 WHERE
> > id=".$_POST['poll_id'];
> >
> > }
> >
> > }
> >
> > if (mysql_query($updatequery)) {
> >
> > print "Thank-you, your vote was added successfully.";
> >
> > }
> > else {
> >
> > print "Sorry, could not add your vote.";
> >
> > }
> > ?>
> >
> > // end regvote.php
> >
> ========================================================================
> > =====================================
> >
> > Hope it works ... didn't have time to test it
> >
> > Good Luck :)
> >  - Robin

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux