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
I think i'm using the syntax incorrectly
Hi Everyone!I'm new to this forum and a newbie with PHP - I'm glad I found this site - I hope to learn a lot! For my first and hopefully one of few questions, lol..I told my boss i'd help him out
Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.When I send an email from an email account set up domain (using, for example, xxx@MyDomain.net) and then view the header
How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart, but I can't figure out how to not overwrite the sessions array each time new checkbox values are
Run function every 5 mins ??
I have a function PostMessage()How can I run it every 5 mins ??
Database connection failure
Hello All,
md5 is it unique
I know this is most likely one of many simple questions that can be found semi easily. But I'm pressed for time. I have searched google, php.net, etc. But it only tells me how to make md5 hashes. Ok
Problem with Sending Mail by PHP
hello all, I m new to php, can u plz provide me the code to send mail by php having CAPTCHA code in the form.i m using the following code :career.phpLine number On/Off | Expand/Contract
SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built in???
preg_match logical error
Code: <?php$s = file_get_contents("page.html");preg_match('/<div class="brown_box main_ge_page vertically_spaced"><div
displaying unknown amount of results
I am reading a directory and getting a list of folders in the directory, I want to display the folders in a table which is 6 columns of results across by how ever may rows, here is the code I am using