values not being entered into table
Posted on
16th Feb 2014 07:03 pm by
admin
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a database. the form submits some data to one table, and other data to another table. my problem is that the data only gets added to the first table, but data doesnt enter correnctly into the other one.
Code: <?PHP
$questionno = $_POST['questionno'];
$question = $_POST['question'];
$quizref = $_POST['quizref'];
$answerno = $_POST['answerno'];
$answer = $_POST['answer'];
$answervalue = $_POST['answervalue'];
pg_connect("host=database.*******.uk
port=5432 dbname=***** user=***** password=******");
?>
<html>
<head>
<title>Add </title>
</head>
<body>
<?php
$query="INSERT INTO questions (questionno, question, quizref)VALUES ('".$questionno."', '".$question."', '".$quizref."')";
pg_query($query) or die ('Error adding new question');
echo "The question has been added to the quiz";
$queryanswers="INSERT INTO answers (answerno, answer, answervalue, questionno, quizref)VALUES ('".$answerno."', '".$answer."','".$answervalue."', '".$questionno."', '".$quizref."')";
pg_query($queryanswers) or die ('Error adding new answers');
echo "The answers has been added to the question";
?>
<form method="post" action="">
quizref: <br/>
<input type="text" name ="quizref" size="5" /><br/>
Question Number: <br/>
<input type="text" name="questionno" size="5" /><br/>
Question: <br/>
<input type="text" name="question" size="60" /><br/>
Answers<br/><br/>
Answer number:<br/>
<input type="text" name ="answerno" size="5" /><br/>
Answer<br/>
<input type="text" name ="answer" size="60" /><br/>
Answer value<br/>
<input type="text" name ="answervalue" size="5" /><br/>
<br/><br/>
Answer number:<br/>
<input type="text" name ="answerno" size="5" /><br/>
Answer<br/>
<input type="text" name ="answer" size="60" /><br/>
Answer value<br/>
<input type="text" name ="answervalue" size="5" /><br/>
<br/><br/>
Answer number:<br/>
<input type="text" name ="answerno" size="5" /><br/>
Answer<br/>
<input type="text" name ="answer" size="60" /><br/>
Answer value<br/>
<input type="text" name ="answervalue" size="5" /><br/>
<br/><br/>
Answer number:<br/>
<input type="text" name ="answerno" size="5" /><br/>
Answer<br/>
<input type="text" name ="answer" size="60" /><br/>
Answer value<br/>
<input type="text" name ="answervalue" size="5" /><br/>
<br/><br/>
<input type="submit" value="Send and Add another Add Questions" />
<a href="addfinish.php"><input type="submit" value="Add and finish" /></a>
</form>
</body>
</html>
Any help would be great.
thanks
315
28
Other php-forum
New Login Script
Hi all, i attempted to create a whole new login script witch isnt working for some reason i dont kno
how can i display php source code snippets ?
I am outputting some pho code .. and I want to display the source code so people can copy and paste
Text to picture Generator
Hello, i have found this script and it works really good^^ But i have one problem, i would like to c
Website Direction...
I recently used this code to try and make it so the page loads as http://www.domain.com/ when you ty
SESSION question
I am building an application , a directory for auctions.
For SEO i made a script which copies a p
Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.
I have a table "quote" wit
Help With editting and deleting form
Hallo !!
So look at this image :
http://img194.imageshack.us/img194/8272/snapshot5f.pn
Send inserts to mysql thru port 80
Hi!
I have an application that must do some inserts in a mysql db. This db is behind a firewa
unexpected T_VARIABLE error
Hey all! I'm getting an unexpected T_VARIABLE with the following function:
function getHighes
=> and <=
So I was digging through some code when I came across the <= operator. This is the first tim