it all seems to work fine but the e-mail is never sent and when it is inserted into the mysql DB the checkboxed options just show array4
i've read the main help thread and tried vcarious things in it but no luck fixing either problem. The main issue with the array in the options field seemed to be connected to moving a field up or down in the list. I was very careful not to do that and even started over a few times just to make sure i created the form from begining to end without having to adjust anything. the mail not going out seems to be related to the 4th field being missing as discussed in one post in the Mail() line however the process.php is being generated without it. I've tried adding one manually but no go.
Any help would be appreciated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had to cut and paste the entire e-mail portion of processor.php to come before the mysql portion. I also had to manually add the 4th required field in the Mail(); line.
The e-mail lists all of the choices made but the database still says array in the field where the optios are stored. so I am unsure if i tried to pull the data back out of the database if I would get valid information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You will need to look at the variables used in the email to see if the variable used to load the sql db are the same. Since you added the form number to your last thread I can take a quick look. I'll post again if I find anything obvious.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK so you see that "$field_4_opts" (comma separated array) is defined and used in the email but "$_POST['field_4']" (array) is put into the sql db.
Since you dont have an easy way (old form generator has an admin) to view the sql db you can not see that the array is stored. Extracting and displaying the array should return similar results to that of "$field_4_opts".
Why did you chose sql if you can not see or use the data?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well the file storage method is not available yet so I needed to have some method of storing the data. and as I am somewhat familiar with sql and learning php/mysql interaction i figured this was a good place to start as i will need to extract the data at some point.
I created a simple php script to pull the data back out of the database to see what it looked like. it can be seen here
as you can see it simply puts array where the array data should be. So I am obviously doing something wrong with pulling the data back out that is not formatting it correctly, or it just isn't being stored right. The goal of the form is to eventually line up people who are wanting to learn a particular "craft" for our SCA group with people who are willing to teach said craft.
here is the script that reads the mysql db and outputs the results
database info blocked out for obvious reasons.
mysql_connect($connect,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM interests";
$result=mysql_query($query);
When you echo the variables it is OK if the variable is not an array. If it is an array you need to extract the array elements before they can be displayed. Add something like this.
for($i=0;$i<sizeof($array_variable);$i++) {
echo "$array_variable[$i]";
}
You will have to manage where to put the for loop in your display code and if the array is multi dimensional then you will need multiple for loops. Try the single loop because that is what you have this time. I think your array_variable is other2.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mysql_connect($connect,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM interests";
$result=mysql_query($query);
Since I am not an expert on SQL maybe the SQL table is not capable or not setup to handle storing an array. Go back to the original code and substitute the comma separated variable for the POST[$field] variable in the SQL function putting data into your table.
Then comback to your display code and see what you get.
Also as long as you are displaying data go ahead and display all the fields to make sure to don't break one thing while you work on another.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created a new form from scratch form#3262
it all seems to work fine but the e-mail is never sent and when it is inserted into the mysql DB the checkboxed options just show array4
i've read the main help thread and tried vcarious things in it but no luck fixing either problem. The main issue with the array in the options field seemed to be connected to moving a field up or down in the list. I was very careful not to do that and even started over a few times just to make sure i created the form from begining to end without having to adjust anything. the mail not going out seems to be related to the 4th field being missing as discussed in one post in the Mail() line however the process.php is being generated without it. I've tried adding one manually but no go.
Any help would be appreciated
okay i figured out the e-mail problem.
I had to cut and paste the entire e-mail portion of processor.php to come before the mysql portion. I also had to manually add the 4th required field in the Mail(); line.
The e-mail lists all of the choices made but the database still says array in the field where the optios are stored. so I am unsure if i tried to pull the data back out of the database if I would get valid information.
You will need to look at the variables used in the email to see if the variable used to load the sql db are the same. Since you added the form number to your last thread I can take a quick look. I'll post again if I find anything obvious.
OK so you see that "$field_4_opts" (comma separated array) is defined and used in the email but "$_POST['field_4']" (array) is put into the sql db.
Since you dont have an easy way (old form generator has an admin) to view the sql db you can not see that the array is stored. Extracting and displaying the array should return similar results to that of "$field_4_opts".
Why did you chose sql if you can not see or use the data?
Well the file storage method is not available yet so I needed to have some method of storing the data. and as I am somewhat familiar with sql and learning php/mysql interaction i figured this was a good place to start as i will need to extract the data at some point.
I created a simple php script to pull the data back out of the database to see what it looked like. it can be seen here
http://www.schattentor.org/newcomer/display.php
as you can see it simply puts array where the array data should be. So I am obviously doing something wrong with pulling the data back out that is not formatting it correctly, or it just isn't being stored right. The goal of the form is to eventually line up people who are wanting to learn a particular "craft" for our SCA group with people who are willing to teach said craft.
here is the script that reads the mysql db and outputs the results
database info blocked out for obvious reasons.
<?
$username="";
$password="";
$database="";
$connect="";
mysql_connect($connect,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM interests";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$name=mysql_result($result,$i,"field_1");
$scaname=mysql_result($result,$i,"field_2");
$persona=mysql_result($result,$i,"field_3");
$phone=mysql_result($result,$i,"field_4");
$email=mysql_result($result,$i,"field_5");
$interest=mysql_result($result,$i,"field_6");
$other1=mysql_result($result,$i,"field_7");
$teach=mysql_result($result,$i,"field_8");
$other2=mysql_result($result,$i,"field_9");
echo "<b>$name</b><br>$scaname<br>$persona<br>$phone<br>$email<br>$interest<br>$other1<br>$teach<br>$other2<br><hr><br>";
$i++;
}
When you echo the variables it is OK if the variable is not an array. If it is an array you need to extract the array elements before they can be displayed. Add something like this.
for($i=0;$i<sizeof($array_variable);$i++) {
echo "$array_variable[$i]";
}
You will have to manage where to put the for loop in your display code and if the array is multi dimensional then you will need multiple for loops. Try the single loop because that is what you have this time. I think your array_variable is other2.
well I am doing something majorly wrong or as I suspect there is actually no data other then the word Array in the database field.
i created another test display called display2.php
all it is is the code below.. when called all i get for display output is 2 capital A's
like
AA
which coincidently is the first character of the word Array and I have 2 records in the database I am testing with.
<?
$username="";
$password="";
$database="";
$connect="";
mysql_connect($connect,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM interests";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><center>Database Output</center></b><br><br>";
$i=0;
while ($i < $num) {
$interest=mysql_result($result,$i,"field_6");
for($o=0;$o<sizeof($interest);$o++) {
echo "$interest[$o]";
}
$i++;
}
Since I am not an expert on SQL maybe the SQL table is not capable or not setup to handle storing an array. Go back to the original code and substitute the comma separated variable for the POST[$field] variable in the SQL function putting data into your table.
Then comback to your display code and see what you get.
Also as long as you are displaying data go ahead and display all the fields to make sure to don't break one thing while you work on another.