php3-list | 199901
Date: 01/03/99
- Next message: Carl Nasal: "[PHP3] php3_* Apache Directives Allowed In .htaccess?"
- Previous message: Peter van Dijk: "Re: [PHP3] Accessing remote pop server to check and compose mail. Any php programs that do this??"
- Next in thread: Colin Viebrock: "RE: [PHP3] Problems with MySQL query."
- Reply: Colin Viebrock: "RE: [PHP3] Problems with MySQL query."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi:
I am trying to do a forms based poll for our website using php/mysql. I have created three tables with the following statements:
CREATE TABLE polls (
poll_id int(9) default '0' NOT NULL auto_increment,
name varchar(255),
date timestamp(14),
PRIMARY KEY (poll_id)
);
CREATE TABLE options (
poll_id int(9),
option_id int(9),
option_text varchar(100)
);
CREATE TABLE votes (
poll_id int(9),
option_id int(9),
ip varchar(30),
date timestamp(14)
);
I have a forms based html page that is to create new polls entering the poll_topic or "name" and the corresponding options (currently 5). I am submitting the page to itself rather than using a second form. The page looks as follows:
<?
include "header.inc";
# include "polls.ini"
$query = "insert into polls (name) values ($poll_topic) ";
$db_connect = mysql_connect("localhost","root","") or DIE("cant connect for some reason");
$success= mysql_db_query("polls",$query );
if ($success) { print "hey it works i think" ; }
?>
<h1> Add New Poll </h1><br>
<form action="polls.php3" method="POST">
Please enter the topic for your poll:<br>
<textarea name=poll_topic rows="6" cols="40"> </textarea> <BR>
Option A:<input type="TEXT" size= name="optionA"><BR>
Option B:<input type="TEXT" name="optionB"><BR>
Option C:<input type="TEXT" name="optionC"><BR>
Option D:<input type="TEXT" name="optionD"><BR>
Option E:<input type="TEXT" name="optionE"><BR>
<BR><input type="SUBMIT" value="Add poll!">
</form>
<?
include "footer.inc"
?>
I have looked at the documentation and it doesnt seem to submit the data. The variable poll_topic is being posted when i submit but the sql query is not being executed! I have taken the query and run it from mysql and it does work. What am i doing wrong??
Any help would be appreciated.
Regards,
Alan LeFort
Walden Internet Villages
"The only apartments with 10 megabit internet access" --> "Soon to have a full DS3 over ATM, woo hoo"
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev <email protected>
- Next message: Carl Nasal: "[PHP3] php3_* Apache Directives Allowed In .htaccess?"
- Previous message: Peter van Dijk: "Re: [PHP3] Accessing remote pop server to check and compose mail. Any php programs that do this??"
- Next in thread: Colin Viebrock: "RE: [PHP3] Problems with MySQL query."
- Reply: Colin Viebrock: "RE: [PHP3] Problems with MySQL query."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

