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
PHP Search Issue
Hi, I am using the following code to search and return flights from a database. The user searches by inputting a DepID and an ArrID and I want to display only flights that match both DepID and ArrID.
Pre-Fill out a PHP form...??
This is for work actually (geek squad). We have to fill out this online php form at work over and over again to set up these new laptops, we log on to this website and have to select all this stuff. I
form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...http://brinsterinc.com/tireclick/test.phpHere's the source...Code:
passing data from one page to another
hey guysi have the follwoing code to get information from one page and place on another:(1st page) page to get info from:Code: <?php session_start();$_SESSION['data'] = "blah blah
php forms and database navigatio
Hello,I'm new to php and i'd like to post the following.I have written code to get records from a DB and i need one record at a time to be filled in a form i created. Then the next record should be
Showing selected item at top of list
Hi,I've got a list of names which i am fetching from database like this: $qry = db_query("SELECT * FROM names"); $i=1; //prepair list $html .=
Login script (probably a simple error)
dbConfig.phpCode: <?// Replace the variable values below// with your specific database information.$host = "localhost";$user = "username";$pass = "password";$db
Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there is a way to track uploading with APC and php 5.2 + ?? any suggestions thanks
If a form submits back to same page do you need to use $get
IM trying to pass page number and year that was selected back to the same page.i have this code Code: echo '<form action="archivedBookings.php" method="get">';
Cannot Connect to Database
I am writing an application to do annual reviews. I cannot get my script to work. Whenever it runs I get the following error:Code: $username='far'; $password='c00lfarus3r@'; $database='far';Warning: