Thanks for help and offer but i can not zip a file to u right now. Sorry
here is the code I just posted (or thought I did) that is the new insert page:
[php]
<?php include("login.php"); ?> <?php session_start(); //MySQL Database Connect-------------------------- include 'login.php'; //Send to DB------------------------------ echo ''; var_dump($_SESSION); echo ''; $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; $email = $_GET['email']; $phone = $_GET['phone']; $eighteen_or_older = $_GET['eighteen_or_older']; $manager_contact = $_GET['manager_contact']; $greeted_promptly = $_GET['greeted_promptly']; $timely_completion = $_GET['timely_completion']; $satisfied = $_GET['satisfied']; $recommend = $_GET['recommend']; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $eighteen_or_older = $_POST['eighteen_or_older']; $manager_contact = $_POST['manager_contact']; $greeted_promptly = $_POST['greeted_promptly']; $timely_completion = $_POST['timely_completion']; $satisfied = $_POST['satisfied']; $recommend = $_POST['recommend']; echo '
'; var_dump($firstname); echo ''; echo '
'; var_dump($lastname); echo ''; echo '
'; var_dump($email); echo ''; echo '
'; var_dump($phone); echo ''; echo '
'; var_dump($eighteen_or_older); echo ''; echo '
'; var_dump($manager_contact); echo ''; echo '
'; var_dump($greeted_promptly); echo ''; echo '
'; var_dump($timely_completion); echo ''; echo '
'; var_dump($satisfied); echo ''; echo '
'; var_dump($recommend); echo ''; $stmt = $mysqli->stmt_init(); if ($stmt->prepare("INSERT INTO service (firstname, lastname, email, phone, greeted_promptly, timely_completion, satisfied, recommend, eighteen_or_older, manager_contact) VALUES (?, ?, ?, ?,?, ?, ?,?, ?, ?)")) { echo '
'; var_dump(email); echo ''; $stmt->bind_param("ss ss ss ss ss", $firstname, $lastname, $email, $phone, $greeted_promptly, $timely_completion, $satisfied, $recommend, $eighteen_or_older, $manager_contact); $stmt->execute();} ?> [/php]
I put spaces between every two of them. Changed them all to strings for now just to be safe…
Also, I vardumped all the results and the output on the web page shows that the only things going into the db are on page three, not the first two pages. Here is output on web page:
array(0) {
}
string(2) “AA”
string(2) “BB”
NULL
string(2) “CC”
NULL
string(2) “no”
NULL
NULL
NULL
NULL
string(5) “email”
I only put the spaces to make it easier for you to see
please go here and look at the manual there and tell me how my section of code is different in the param count regard…http://www.php.net/manual/en/mysqli-stmt.bind-param.php
please go here and look at the manual there and tell me how my section of code is different in the param count regard…http://www.php.net/manual/en/mysqli-stmt.bind-param.php
did it your way, here is error
No data supplied for parameters in prepared statement in…on line 93
I do appreciate your trying to help me though…
if I make the one page form and alter the code to this, it works
something is wrong when I try to break the code into a three page form
[php]
Please answer four quick questions about your service today:
Before we start, what is your email address:
1 of 4. Were you greeted promptly upon arrival today?
Yes
No
2 of 4. Was your service completed within the promised time?
Yes
No
Proceeding...3 of 4. Was the work completed to your satisfaction?
Yes 4 of 4. Will you recommend us to friends?
Yes
Your First Name: Your Last Name: Your Phone Number, Optional: Are you at least 18 years old? Yes No Would you like to be contacted by a manager? Yes No By clicking submit below you agree to our contest terms. [/php] and insert page [php] <?php include("login.php"); ?> <?php //MySQL Database Connect-------------------------- include 'login.php'; //Send to DB------------------------------ $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $eighteen_or_older = $_POST['eighteen_or_older']; $manager_contact = $_POST['manager_contact']; $greeted_promptly = $_POST['greeted_promptly']; $timely_completion = $_POST['timely_completion']; $satisfied = $_POST['satisfied']; $recommend = $_POST['recommend']; echo ''; var_dump($firstname); echo ''; echo ' '; var_dump($lastname); echo ''; echo ' '; var_dump($email); echo ''; echo ' '; var_dump($phone); echo ''; echo ' '; var_dump($eighteen_or_older); echo ''; echo ' '; var_dump($manager_contact); echo ''; echo ' '; var_dump($greeted_promptly); echo ''; echo ' '; var_dump($timely_completion); echo ''; echo ' '; var_dump($satisfied); echo ''; echo ' '; var_dump($recommend); echo ''; $stmt = $mysqli->prepare("INSERT INTO `esc2_feedback`.`service` (`firstname`, `lastname`, `email`, `phone`, `greeted_promptly`, `timely_completion`, `satisfied`, `recommend`, `eighteen_or_older`, `manager_contact`) VALUES (?, ?, ?, ?,?, ?, ?,?, ?, ?)"); $stmt->bind_param('ssssssssss', $firstname, $lastname, $email, $phone, $greeted_promptly, $timely_completion, $satisfied, $recommend, $eighteen_or_older, $manager_contact); $stmt->execute(); ?> [/php] |
Add all the forms / processing pages in correct order and I’ll have a look. The thread is such a mess now it’s hard to figure out what’s what.
I finally figured out what he wanted reading all the other posts. Perfect XY Problem. Here you go bro!
- I personally would not split up such a small form like this. I used your html. It could be better.
[php]<?php
session_start();
if (isset($_GET[‘insert’]))
{
$mysqli = new mysqli(‘localhost’, ‘root’, ‘’, ‘YOURDB’);
$stmt = $mysqli->prepare(“INSERT INTO service
(firstname
, lastname
, email
, phone
, greeted_promptly
, timely_completion
, satisfied
, recommend
, eighteen_or_older
, manager_contact
) VALUES (?, ?, ?, ?,?, ?, ?,?, ?, ?)”);
if (!$stmt)
{
echo "Error: " . $mysqli->error;
exit;
}
$stmt->bind_param(‘ssssssssss’, $_POST[‘firstname’], $_POST[‘lastname’], $_SESSION[‘email’], $_POST[‘phone’], $_SESSION[‘greeted_promptly’], $_SESSION[‘timely_completion’], $_SESSION[‘satisfied’], $_SESSION[‘recommend’], $_POST[‘eighteen_or_older’], $_POST[‘manager_contact’]);
$stmt->execute();
session_destroy();
exit;
}
?>
?>
Proceeding...
<p>3 of 4. Was the work completed to your satisfaction?</p><input type="radio" name="satisfied" value="yes">Yes<br>
<input type="radio" name="satisfied" value="no">No
<p>4 of 4. Will you recommend us to friends?</p>
<input type="radio" name="recommend" value="yes">Yes<br>
<input type="radio" name="recommend" value="no">No <label>
<input type="submit" name="continue2" id="continue2" value="Continue"></label>
<?php exit;}?>
<?php
if (isset($_GET['3']))
{
$_SESSION['satisfied'] = $_POST['satisfied'];
$_SESSION['recommend'] = $_POST['recommend'];
?>
Your First Name:
<p>Your Last Name: <label><input type="text" name="lastname" id="lastname"></label></p>
<p>Your Phone Number, Optional: <label><input type="text" name="phone" id="phone"></label></p>
<p>Are you at least 18 years old?
<input type="radio" name="eighteen_or_older" value="yes">Yes
<input type="radio" name="eighteen_or_older" value="no">No</p>
Would you like to be contacted by a manager?
<input type="radio" name="manager_contact" value="yes">Yes
<input type="radio" name="manager_contact" value="no">No
<p>By clicking submit below you agree to our contest terms.</p>
<label><input type="submit" name="I Agree" id="Submit" value="Submit"></label>
<?php exit;}?>
Please answer four quick questions about your service today:
Before we start, what is your email address:<p>1 of 4. Were you greeted promptly upon arrival today?</p>
<input type="radio" name="greeted_promptly" value="yes">Yes<br>
<input type="radio" name="greeted_promptly" value="no">No
<p>2 of 4. Was your service completed within the promised time?</p>
<input type="radio" name="timely_completion" value="yes">Yes<br>
<input type="radio" name="timely_completion" value="no">No <label>
<input type="submit" name="continue" id="continue" value="Continue"></label>
[/php]
thanks but that doesn’t work for me
doesn’t seem to be set up right
maybe it’s me…
here is a one page form that works.
i want to know how to split it into a three page form
the cookies and/or sessions are giving me trouble
any advice? thanks
[php]
Please answer four quick questions about your service today:
Before we start, what is your email address:
1 of 4. Were you greeted promptly upon arrival today?
Yes
No
2 of 4. Was your service completed within the promised time?
Yes
No
Proceeding...3 of 4. Was the work completed to your satisfaction?
Yes 4 of 4. Will you recommend us to friends?
Yes
Your First Name: Your Last Name: Your Phone Number, Optional: Are you at least 18 years old? Yes No Would you like to be contacted by a manager? Yes No By clicking submit below you agree to our contest terms. [/php] and this processes it just fine, inserting into db [php] <?php include("login.php"); ?> <?php //MySQL Database Connect-------------------------- include 'login.php'; //Send to DB------------------------------ $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $eighteen_or_older = $_POST['eighteen_or_older']; $manager_contact = $_POST['manager_contact']; $greeted_promptly = $_POST['greeted_promptly']; $timely_completion = $_POST['timely_completion']; $satisfied = $_POST['satisfied']; $recommend = $_POST['recommend']; echo ''; var_dump($firstname); echo ''; echo ' '; var_dump($lastname); echo ''; echo ' '; var_dump($email); echo ''; echo ' '; var_dump($phone); echo ''; echo ' '; var_dump($eighteen_or_older); echo ''; echo ' '; var_dump($manager_contact); echo ''; echo ' '; var_dump($greeted_promptly); echo ''; echo ' '; var_dump($timely_completion); echo ''; echo ' '; var_dump($satisfied); echo ''; echo ' '; var_dump($recommend); echo ''; $stmt = $mysqli->prepare("INSERT INTO `esc2_feedback`.`service` (`firstname`, `lastname`, `email`, `phone`, `greeted_promptly`, `timely_completion`, `satisfied`, `recommend`, `eighteen_or_older`, `manager_contact`) VALUES (?, ?, ?, ?,?, ?, ?,?, ?, ?)"); ?> $stmt->bind_param(‘ssssssssss’, $firstname, $lastname, $email, $phone, $greeted_promptly, $timely_completion, $satisfied, $recommend, $eighteen_or_older, $manager_contact);
//---------------------------- |
What I posted is exactly what you asked for and it works. What exactly happens when you run MY code? If you want to PM me a temporary login to your server I will see whats going on.
wont go past page 2
What is the URL you have it at?
man it’s just a test learning site for me
don’t really wanna put that info out there
especially as insecure as this code is right now
it’s really no biggie
I wanted to break the form up so it filled up mobile screens better
that’s all
OK, but just saying it doesn’t go past page 2 doesn’t help me. Exactly what happens when you submit the fields from the second screen?
it brings me back to the first page of the form instead of going to page two of the form
it reshows email, question 1-2 instead of questions 3-4
signing off for nite
sorry and thanks again
worked today
tired
If you are running it exactly as I posted it, It is impossible for it to go back to the first page submitting the forms.