By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,723 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,723 IT Pros & Developers. It's quick & easy.

err php

P: n/a
HI THERE

I have created a form that I use to fill with the customer and workorder
information. Depends on what button I press I can add delete change or
print the customer information. My script is called process.php

Then depends on the action scripts call another php script.

Then it checks if customer exist ot not. If exist it goes to another form
and fills in the customer information. If there is no such a customer it
goes back
to the main form.

My problems is that when is goes back to original form it displays this
error:

Warning: extract() expects first argument to be an array in
/var/www/html/login/checkdata.php on line 17

Also, do you know how to delete cached information releted to forms.
Sometimes it is showing up and even the reset button cannot delet it.

Those are my two scripts process.php and checkdata.php
PROCESS SCRIPT
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php

$host = "localhost";
$login_name = "root";
$password = "xxx";

//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");

//Select the database we want to use
MySQL_select_db("lexon") or die("Could not select database");

//Assign contents of form to variables
//Customer Data
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$ss = $_POST['ss'];
$cc = $_POST['cc'];
$exp = $_POST['exp'];
$notes = $_POST['notes'];
$customerid = $_POST['customerid'];

//Wordorder Data
$date = $_POST['date'];
$time = $_POST['time'];
$service = $_POST['service'];
$due = $_POST['due'];
$special = $_POST['special'];
$extrawork = $_POST['extrawork'];
$due2= $_POST['due2'];
$company= $_POST['company'];
$installer= $_POST['installer'];
$total = $due + $due2;

$select = $_POST['select'] ;

if ($select == 'check') {
//function to get data from database
include '../login/checkdata.php';
}
if ($select == 'save') {
//function to save data into database
include '../login/save.php';
}

if ($select == 'addcustomer') {
//function to save customer data into database
include '../login/addcustomer.php';
}

if ($select == 'save-print') {
//function to save customer data into database
include '../login/save-print.php';
}

if ($select == 'addworkorder') {
//function to save customer data into database
include '../login/add-workorder.php';
}

//Close connection with MySQL
MySQL_close()
?>
</td>
</tr>
</table>

CHECK DATA

<?php
$getdata = "select * from addressindex where name = '$name'";
$result = mysql_query($getdata);

//Code to check if statement executed properly and display message

if ($result) {

//put the row into array

$array = mysql_fetch_assoc($result);

//extract the field names

$getdata=extract($array) ;

if ($getdata) {

include '../login/existcustomer.php';

}

else {

include '../login/newcustomer.php';

}

}

else {

include '../login/error-broken.php';

}

?>

Jul 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


"Bartosz Wegrzyn" <bl*******@lexon.ws> wrote in message
news:dz********************@newssrv26.news.prodigy .com...
HI THERE

I have created a form that I use to fill with the customer and workorder
information. Depends on what button I press I can add delete change or
print the customer information. My script is called process.php

Then depends on the action scripts call another php script.

Then it checks if customer exist ot not. If exist it goes to another form
and fills in the customer information. If there is no such a customer it
goes back
to the main form.

My problems is that when is goes back to original form it displays this
error:

Warning: extract() expects first argument to be an array in
/var/www/html/login/checkdata.php on line 17

Also, do you know how to delete cached information releted to forms.
Sometimes it is showing up and even the reset button cannot delet it.

Those are my two scripts process.php and checkdata.php
PROCESS SCRIPT
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php

$host = "localhost";
$login_name = "root";
$password = "xxx";

//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");

//Select the database we want to use
MySQL_select_db("lexon") or die("Could not select database");

//Assign contents of form to variables
//Customer Data
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$ss = $_POST['ss'];
$cc = $_POST['cc'];
$exp = $_POST['exp'];
$notes = $_POST['notes'];
$customerid = $_POST['customerid'];

//Wordorder Data
$date = $_POST['date'];
$time = $_POST['time'];
$service = $_POST['service'];
$due = $_POST['due'];
$special = $_POST['special'];
$extrawork = $_POST['extrawork'];
$due2= $_POST['due2'];
$company= $_POST['company'];
$installer= $_POST['installer'];
$total = $due + $due2;

$select = $_POST['select'] ;

if ($select == 'check') {
//function to get data from database
include '../login/checkdata.php';
}
if ($select == 'save') {
//function to save data into database
include '../login/save.php';
}

if ($select == 'addcustomer') {
//function to save customer data into database
include '../login/addcustomer.php';
}

if ($select == 'save-print') {
//function to save customer data into database
include '../login/save-print.php';
}

if ($select == 'addworkorder') {
//function to save customer data into database
include '../login/add-workorder.php';
}

//Close connection with MySQL
MySQL_close()
?>
</td>
</tr>
</table>

CHECK DATA

<?php
$getdata = "select * from addressindex where name = '$name'";
$result = mysql_query($getdata);

//Code to check if statement executed properly and display message

if ($result) {

//put the row into array

$array = mysql_fetch_assoc($result);

//extract the field names

$getdata=extract($array) ;

if ($getdata) {

include '../login/existcustomer.php';

}

else {

include '../login/newcustomer.php';

}

}

else {

include '../login/error-broken.php';

}

?>

In your checkdata.php function/script - change the if($result) to
if(isset($result)) - it sounds like your conditional statement is always
proving true hence the request to extract is always being performed...

Jul 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.