PHP - Putting A Blank Value Into Mysql?
<?php $PostID = mysql_escape_string($_GET['postid']); ?> <?php If ($_GET['CODE'] == '0') { $GetPostData = "SELECT * FROM ".FORUM_POSTS." WHERE post_id='{$PostID}'"; $GetPostRes = mysql_query($GetPostData, $db); $PostText = mysql_result($GetPostRes, 0, 'post_text'); $AuthorID = mysql_result($GetPostRes, 0, 'user_id'); If ($memid == $AuthorID || $MemLevel >= 1000) { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Editing Post</div> <form action="index.php?act=edit&postid=<?php echo $PostID; ?>&CODE=1" method="POST"> <table width="100%" cellspacing="1" cellpadding="4"> <tr> <td class="titlemedium" colspan="2">Make changes below.</td> </tr> <tr> <td class="row2" align="right" width="15%" valign="top">Post Text:</td> <td class="row2" align="left" width="85%"> <textarea cols="80" rows="20" name="posttext"><?php echo $PostText; ?></textarea> </td> </tr> <tr><td class="row2" colspan="2" align="center"><input type="submit" value="Post" /></td></tr> </table> </form> <?php } Else { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Error</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">You do not have the permission to edit this post.<br>If you believe this is an error please contact an administrator.</td></tr> </table> <?php } } If ($_GET['CODE'] == '1') { //Gather Information $PostText = mysql_escape_string($_POST['posttext']); $PostText = htmlentities($PostText); $PostID = mysql_escape_string($_GET['postid']); //Update Database $EditQry = "UPDATE ".FORUM_POSTS." SET post_text='{$PostText}' WHERE post_id='{$PostID}'"; $EditRes = mysql_query($EditQry, $db); //Check Data went in If (!$EditRes) { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Error</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">Could not modify database. Please contact administrator.</td></tr> </table> <?php } Else { ?> <div class="maintitle" align="left"><img src="./images/nav_m.gif" width="8" height="8"> Success</div> <table width="100%" cellspacing="1" cellpadding="4"> <tr><td class="row2">Post modified. Please go back to the thread to see it.</td></tr> </table> <?php } } ?> </div> This is my page for editing a post. However, whenever this form actually goes through, the query for some reason makes post_text in the database blank with no text in it whatsoever. I have tried echoing the query to see what it says and it has a perfectly fine query and I can copy/paste it manually to put it into the mysql but I don't get why this isn't adding it. Similar TutorialsHello everyone, Sorry if this has been answered but if it has I can't find it anywhere. So, from the begining then. Lets say I had a member table and in it I wanted to store what their top 3 interests are. Their$ row has all the usual things to identify them userID and password etc.. and I had a further 3 columns which were labled top3_1 top3_2 & top3_3 to put each of their interests in from a post form. If instead I wanted to store this data as a PHP Array instead (using 1 column instead of 3) is there a way to store it as readable data when you open the PHPmyadmin? At the moment all it says is array and when I call it back to the browser (say on a page where they could review and update their interests) it displays 'a' as top3_01 'r' as top3_02 and 'r' as top3_03 (in each putting what would be 'array' as it appears in the table if there were 5 results. Does anyone know what I mean? For example - If we had a form which collected the top 3 interests to put in a table called users, Code: [Select] <form action="back_to_same_page_for_processing.php" method="post" enctype="multipart/form-data"> <input name="top3_01" type="text" value="enter interest number 1 here" /> <input name="top3_02" type="text" value="enter interest number 2 here" /> <input name="top3_03" type="text" value="enter interest number 3 here" /> <input type="submit" name="update_button" value=" Save and Update! " /> </form> // If my quick code example for this form is not correct dont worry its not the point im getting at :) And they put 'bowling' in top3_01, 'running' in top3_02 and 'diving' in top3_03 and we catch that on the same page with some PHP at the top --> Code: [Select] if (isset($_POST)['update_button']) { $top3_01 = $_POST['top3_01']; // i.e, 'bowling' changing POST vars to local vars $top3_02 = $_POST['top3_02']; // i.e, 'running' $top3_03 = $_POST['top3_03']; // i.e, 'diving' With me so far? If I had a table which had 3 columns (1 for each interest) I could put something like - Code: [Select] include('connect_msql.php'); mysql_query("Select * FROM users WHERE id='$id' AND blah blah blah"); mysql_query("UPDATE users SET top3_01='$top3_01', top3_02='$top3_02', top3_03='$top3_03' WHERE id='$id'"); And hopefully if ive got it right, it will put them each in their own little column. Easy enough huh? But heres the thing, I want to put all these into an array to be stored in the 1 column (say called 'top3') and whats more have them clearly readable in PHPmyadmin and editable from there yet still be able to be called back an rendered on page when requested. Continuing the example then, assuming ive changed the table for the 'top3' column instead of individual colums, I could put something like this - Code: [Select] if (isset($_POST)['update_button']) { $top3_01 = $_POST['top3_01']; // i.e, 'bowling' changing POST vars to local vars $top3_02 = $_POST['top3_02']; // i.e, 'running' $top3_03 = $_POST['top3_03']; // i.e, 'diving' $top3_array = array($top3_01,$top3_02,$top3_03); include('connect_msql.php'); mysql_query("UPDATE members SET top3='$top3_array' WHERE id='$id' AND blah blah blah"); But it will appear in the column as 'Array' and when its called for using a query it will render the literal string. a r r in each field instead. Now I know you can use the 'serialize()' & 'unserialize()' funtcions but it makes the entry in the database practically unreadable. Is there a way to make it readable and editable without having to create a content management system? If so please let me know and I'll be your friend forever, lol, ok maybe not but I'd really appreciate the help anyways. The other thing is, If you can do this or something like it, how am I to add entries to that array to go back into the data base? I hope ive explained myself enough here, but if not say so and I'll have another go. Thanks very much people, L-PLate (P.s if I sort this out on my own ill post it all here) Hi, I am still learning php and I've been racking my brain to get some field data from the mysql database and put the results into variables to use. I need to do a query to get the data from two fields and place them in a variable. I have this field from a form: $_REQUEST['linkurl'] So i need to check this form field against (tablename, fieldname) alldomain.domain_name when the match is found I need to store the value of tablename, fieldname) domain.manual_approve into $x_manual_approve and then check that rows userid field: (tablename, fieldname) alldomain.userid and equals (tablename, fieldname) register.id the userid and id are matching from two different tables (tables alldomain and register). When I get that match I need to get (tablename, fieldname) register.username and store the value into $x_username Thanks much for any help, Gibs Hi all, I have implemented a WYSIWYG in my admin panel, here i can write text and customize it how i want it and then convert it to a html code and save it in my mysql database. Now I want to let other people see the text in the homepage, but it is showing this text very wrong functions like this Code: [Select] <p> <b> <strong> <font> arent working. For example I make text Code: [Select] <b>title</b> <strong> blabla bla bla </strong> then the text becomes like this litterly Quote "<b>title<b> <strong> blabla bla bla </strong> " the codes have no effect and are seen as text in the homepage. My question is how is this possible and how can i fix this, thanks. The code on my homepage is like this Code: [Select] <?php $tekst="SELECT * from homepage where id='1'"; $tekst2=mysql_query($tekst) or die("unable to connect"); $tekst3=mysql_fetch_array($tekst2); print "$tekst3[tekst]"; ?> Hi, I have two html made text boxes one that is called "name" and another that is called "regnum". I also have a submit button. They are both used to add data to a database. The name text box should add a name to the database under the "name" heading and the regnum should add a number under the "regnum" heading Here is the code for them: HTML Code: <form action="" method="post"> <p> Name: <input type="text" name="name"/> </p> <p> Regnum: <input type="text" name="regnum"/> </p> <p> <input type="submit" value="Add To Database" name = "submit2" /> </p> </form> Here is the PHP code that i am using for adding the user to the database: PHP Code: $host="localhost"; $username="root"; $password=""; $database="lab2"; mysql_connect("$host", "$username", "$password") or die(mysql_error()); mysql_select_db("$database") or die(mysql_error()); $name = $_POST['name']; $regnum = $_POST['regnum']; if(!$_POST['submit2']){ echo "Enter A Vaue"; }else{ mysql_query("INSERT INTO lab2('name', 'regnum') VALUES(NULL, '$name', '$regnum')") or die(mysql_error()); echo "User Added To Database"; } The problem i get with this is "Undefined Index name and regnum". I watched a video on youtube and this is how the guy did it but it worked for him and for some reason it doesn't work for me. Can anyone help?? Thanks. So I have a big table of about 30-40 columns. Some variables are quite long strings while others are simple tinyint(1) values.
Input into the code is a value or range of values or something that applies to each of the columns.
I need to find which ones are an applicable match to the user request and then load them into php.
Now I know variations can cause something to run more optimally one way or another but this system will get bogged down with lots of requests and lots of data, so any additional performance I give it now will help me down the road. I am just looking for general concepts to help, not specific code tweaking.
I have heard the typical rule is to query mysql as little as possible and do the hard lifting in php but I am not positive this is right.
Since I have to query anyways, should I do a mysql pull using a complex 'WHERE' to do most of the sorting. ie only get rows where a=1, b>5, c="http://google.com", d="3242342323kj4238237489023ejfjf3jrjf8jeifjdjf" ie long string, etc for all 30+columns?
OR I pull the whole DB and do all the sorting in php...
OR I do all the simple sorting in the MySQL query and some of the more complicated sorting in PHP (or vice versa)
Any ideas would help.
Hi again all, Why does the foreach loop im doing, put the array values from collection, into seperate table rows rather than 1 row per whole array? <?php class registration{ public $fields = array("username", "email", "password"); public $data = array(); public $table = "users"; public $dateTime = ""; public $datePos = 0; public $dateEntryName = "date"; public $connection; function timeStamp(){ return($this->dateTime = date("Y-m-d H:i:s")); } function insertRow($collection){ //HERE foreach($this->fields as $row => $value){ mysql_query("INSERT INTO $this->table ($value) VALUES ('$collection[$row]')"); } mysql_close($this->connection->connectData); } function validateFields(){ $this->connection = new connection(); $this->connection->connect(); foreach($this->fields as $key => $value){ array_push($this->data, $_POST[$this->fields[$key]]); } $this->dateTime = $this->timeStamp(); array_unshift($this->data, $this->dateTime); array_unshift($this->fields, $this->dateEntryName); foreach($this->data as $value){ echo "$value"; } $this->insertRow($this->data); } } $registration = new registration(); $registration->validateFields(); ?> I end up with 3 rows row 1: username row 2: email row 3 : password rather than row 1:username email password. Hey guys, I have a private message script but for some reason when its updating, it turns the value into a blank one from 1 to 3. I have no idea why, but it works with the old statement of deleting, but I changed it to instead update it to 3 because I want to keep the pm in archives. here is the delete PM part. <?php session_start(); header("Location:inbox.php"); $user = $_SESSION['username']; include 'db.php'; //We do not have a user check on this page, because it seems silly to, you just send data to this page then it directs you right back to inbox //We need to get the total number of private messages the user has $sql = mysql_query ("SELECT pm_count FROM users WHERE username='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; //A foreach loop for each pm in the array, get the values and set it as $pm_id because they were the ones selected for deletion foreach($_POST['pms'] as $num => $pm_id) { //Delete the PM from the database mysql_query("UPDATE messages SET recieved='3' WHERE id='$pm_id' AND reciever='$user'"); // mysql_query("DELETE FROM messages WHERE id='$pm_id' AND reciever='$user'"); //Subtract a private message from the counter! YAY! //$pm_count = $pm_count - '1'; //Now update the users message count with the new value //mysql_query("UPDATE users SET pm_count='$pm_count' WHERE username='$user'"); } ?> The commented out part at the end, is the old deleting parts but instead changed it to update value. Here is my form that shows checkboxes. I showed the whole code, where it has comments. <?php //This stuff and the while loop will query the database, see if you have messages or not, and display them if you do $query = "SELECT id, sender, subject, message FROM messages WHERE reciever='$user' AND recieved='1'"; $sqlinbox = mysql_query($query); //We have a mysql error, we should probably let somone know about the error, so we should print the error if(!$sqlinbox) { ?> <p><?php print '$query: '.$query.mysql_error();?></p> <?php } //There are no rows found for the user that is logged in, so that either means they have no messages or something broke, lets assume them they have no messages elseif (!mysql_num_rows($sqlinbox) ) { ?> <center><p><b>You havent read any messages</b></p></center> <?php } //There are no errors, and they do have messages, lets query the database and get the information after we make a table to put the information into else { //Ok, Lets center this whole table Im going to make just because I like it like that //Then we create a table 80% the total width, with 3 columns, The subject is 75% of the whole table, the sender is 120 pixels (should be plenty) and the select checkboxes only get 25 pixels ?> <center> <form name="send" method="post" action="delete.php"> <table width="80%"> <tr> <td width="75%" valign="top"><p><b><u>Subject</u></b></p></td> <td width="120px" valign="top"><p><b><u>Sender</u></b></p></td> <td width="25px" valign="top"><p><b><u>Select</u></b></p></td> </tr> <?php //Since everything is good so far and we earlier did a query to get all the message information we need to display the information. //This while loop goes through the array outputting all of the message information while($inbox = mysql_fetch_array($sqlinbox)) { //These are the variables we get from the array as it is going through the messages, we have the id of the private message, we have the person who sent the message, we have the subject of the message, and yeah thats it $pm_id = $inbox['id']; $sender = $inbox['sender']; $subject = $inbox['subject']; //So lets show the subject and make that a link to the view message page, we will send the message id through the URL to the view message page so the message can be displayed //And also let the person see who sent it to them, if you want you can make that some sort of a link to view more stuff about the user, but Im not doing that here, I did it for my game though, similar to the viewmsg.php page but a different page, and with the senders id //And finally the checkboxes that are all stuck into an array and if they are selected we stick the private message id into the array //I will only let my users have a maximum of 50 messages, remeber that ok? Because that's the value I will later in another page //Here is finally the html output for the message data, the while loop keeps going untill it runs out of messages ?> <tr> <td width="75%" valign="top"><p><a href="viewmsg.php?msg_id=<?php echo $pm_id; ?>"><?php echo $subject; ?></a></p></td> <td width="120px" valign="top"><p><?php echo $sender; ?></p></td> <td width="25px" valign="top"><input name="pms[]" type="checkbox" value="<?php echo $pm_id; ?>"></td> </tr> <?php //This ends the while loop } //Here is a submit button for the form that sends the delete page the message ids in an array ?> <tr> <td colspan="3"><input type="submit" name="Submit" value="Delete Selected"></td> <td></td> <td></td> </tr> </table> </center> <?php //So this ends the else to see if it is all ok and having messages or not } ?> So yeah, does anyone know why it updates it to a blank value, from the value 1 in recieved? Shouldn't the following stop a blank row from being inserted into mysql? I have a description and a date but it still keeps putting a blank row before my insert and I've tried everything.... if($myvar != ''){ mysql_query("INSERT IGNORE INTO products (description, time) VALUES('$myvar',NOW() ) ") or die(mysql_error()); Hi
I have another problem with my code
I have records in my database and i want to put them in Jgrid but no records are show.
This is my php
<?php error_reporting(0); require_once 'database_connection.php'; $page = $_GET['page']; // get the requested page $limit = $_GET['rows']; // get how many rows we want to have into the grid $sidx = $_GET['sidx']; // get index row - i.e. user click to sort $sord = $_GET['sord']; // get the direction if(!$sidx) $sidx =1; // connect to the database $result = mysql_query("SELECT COUNT(*) AS count FROM utilizador"); $row = mysql_fetch_array($result,MYSQL_ASSOC); $count = $row['count']; if( $count >0 ) { $total_pages = ceil($count/$limit); } else { $total_pages = 0; } if ($page > $total_pages) $page=$total_pages; $start = $limit*$page - $limit; // do not put $limit*($page - 1) $SQL = "SELECT * FROM utilizador ORDER BY $sidx $sord LIMIT $start , $limit"; $result = mysql_query( $SQL ) or die("Couldn t execute query.".mysql_error()); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $responce->rows[$i]['id']=$row[idutilizador]; $responce->rows[$i]['cell']=array($row[idutilizador],$row[nome],$row[utilizador],$row[telefone],$row[email]); $i++; } echo json_encode($responce); ?>And this is the Jgrid <html> <head> <title>jQGrid example</title> <!-- Load CSS--><br /> <link rel="stylesheet" href="css/ui.jqgrid.css" type="text/css" media="all" /> <!-- For this theme, download your own from link above, and place it at css folder --> <link rel="stylesheet" href="css/jquery-ui-1.9.2.custom.css" type="text/css" media="all" /> <!-- Load Javascript --> <script src="js/jquery_1.5.2.js" type="text/javascript"></script> <script src="js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script> <script src="js/i18n/grid.locale-pt.js" type="text/javascript"></script> <script src="js/jquery.jqGrid.min.js" type="text/javascript"></script> </head> <body> <table id="datagrid"></table> <div id="navGrid"></div> <p><script language="javascript"> jQuery("#datagrid").jqGrid({ url:'example.php', datatype: "json", colNames:['Idutilizador','Nome', 'Utilizador', 'Telefone','Email'], colModel:[ {name:'idutilizador',index:'idutilizador', width:55,editable:false,editoptions:{readonly:true,size:10}}, {name:'nome',index:'nome', width:80,editable:true,editoptions:{size:10}}, {name:'idutilizador',index:'idutilizador', width:90,editable:true,editoptions:{size:25}}, {name:'telefone',index:'telefone', width:60, align:"right",editable:true,editoptions:{size:10}}, {name:'email',index:'email', width:60, align:"right",editable:true,editoptions:{size:10}} ], rowNum:10, rowList:[10,15,20,25,30,35,40], pager: '#navGrid', sortname: 'idutilizador', sortorder: "asc", height: 500, width:900, viewrecords: true, caption:"Atividades Registadas" }); jQuery("#datagrid").jqGrid('navGrid','#navGrid',{edit:true,add:true,del:true}); </script> </body> </html>Anything wrong with the code? Regards Hi there, I am using this code to send the users email address to the database. That works fine, but i keep getting blank info added to the database. Does anyone know how i can stop this? <?php $con = mysql_connect("*","*","*"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ogs_mailinglist1", $con); $sql="INSERT INTO mailinglist (email) VALUES ('$_POST[rec_email]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con); ?> Thanks, I have a table like this: http://empirebuildingsestate.com/company.html How can I separate the table values into variables so I can insert them into my mySQL database? I have been trying DOMDocument but i need some help. Howdy All i currently have Code: [Select] <? echo $guild ['name'];?> and i want to put <> around what is shown from the $guild ['name'] , but where ever i try the <> it cancels out and just doesnt show the name any more - currently its making us do the following <-<? echo $guild ['name'];?>-> as even if we try an echo with jsut the < and > it cancels it out Any specific way in which i can do this thanks Ok so for some reasons on my register and edit profile page when i hit submit it says that i have not filled in all the info i need.. Even after i fill all of them in.. but heres the code for the register form.. Code: [Select] <?php require("top.php"); ?> <div id='homeright'> <?php echo "<font size='6'>Sign up</font>"; echo "<hr width='75%' align='left'/>"; $form = "<form action='index.php' method='post'> <table cellspacing='5px'> <tr> <td>First Name:</td> <td class='register'><input type='text' name='firstname' class='textbox' size='35'></td> </tr> <tr> <td>Last Name:</td> <td><input type='text' name='lastname' class='textbox' size='35'></td> </tr> <tr> <td>Username:</td> <td><input type='text' name='username' class='textbox' size='35'></td> </tr> <tr> <td>E-mail:</td> <td><input type='text' name='email' class='textbox' size='35'></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password' class='textbox' size='35'></td> </tr> <tr> <td>Confirm Password:</td> <td><input type='password' name='repassword' class='textbox' size='35'></td> </tr> <tr> <td></td> <td><input type='submit' name='submitbtn' value='Register' class='button'></td> </tr> </table> </form>"; if ($_POST['submitbtn']){ $firstname = fixtext($_POST['firstname']); $lastname = fixtext($_POST['lastname']); $username = fixtext($_POST['username']); $email = fixtext($_POST['email']); $password = fixtext($_POST['password']); $repassword = fixtext($_POST['repassword']); $website = fixtext($_POST['website']); $youtube = fixtext($_POST['youtube']); $bio = fixtext($_POST['bio']); $name = $_FILES['avatar'] ['name']; $type = $_FILES['avatar'] ['type']; $size = $_FILES['avatar'] ['size']; $tmpname = $_FILES['avatar']['tmpname']; $ext = substr($name, strrpos($name, '.')); if ($firstname && $lastname && $username && $email && $password && $repassword){ if ($password == $repassword){ if (strstr($email, "@") && strstr($email, ".") && strlen($email) >= 6){ require("scripts/connect.php"); /*$query = mysql_query("SELECT * FROM users WHERE username='$username' ");*/ $query=mysql_query("SELECT * FROM users WHERE username='$username' ") or die(mysql_error()); $numrows = mysql_num_rows($query); if ($numrows == 0){ /*$query=mysql_query("SELECT * FROM users WHERE email='$email' ");*/ $query=mysql_query("SELECT * FROM users WHERE email='$email' ") or die(mysql_error()); $numrows=mysql_num_rows($query); if ($numrows == 0){ $pass = md5(md5($password)); $date = date("F d, Y"); if($name){ move_uploaded_file($tmpname, "avatars/$username.$ext"); $avatar = "$username.$ext"; } else $avatar = "/avatars/default_avatar.png"; $code = substr (md5(rand(11111111111, 999999999999999)), 2, 25); mysql_query("INSERT INTO users (`first_name`,`last_name`,`username`,`email`,`password`,`avatar`,`bio`,`website`,`youtube`,`last_login`,`active`,`code`,`locked`,`date`) VALUES ( '$firstname', '$lastname', '$username', '$email', '$pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')"); /*mysql_query("INSERT INTO users (Field, Type) VALUES ('', '$firstname', '$lastname', '$username', '$email', 'pass', '$avatar', '$bio', '$website', '$youtube', '', '0', '$code', '0', '$date')");*/ $webmaster = "Admin@trucksite.com"; $subject = "Activate Your Account!"; $headers = "From: Admin <$webmaster>"; $message = "Hello $firstname.\n\nWelcome to trucksite below is a link for you to activate your account!.\n http://tprofiletesting.net23.net/activate.php?code=$code"; mail($email, $subject, $message, $headers); echo "Your activation email has been sent to <b>$email</b>."; } else echo "That email is currently in use."; } else echo "That username is currently in use."; } else echo "You did not enter a vaild email."; } else echo "Your passwords did not match."; } else echo"You did not fill in all the required fields."; } echo "$form"; ?> </div> <div id='homeleft'> <center><font size='6'>Create! Showoff! Educate!</font></center> <hr /> </div> </body> </html> i'm back again and i am not very good with tables as the <tr> and <td> tags confuse me i need to put 2 sets of links into 2 columns in the table and they come out jumbled up. Code: [Select] <table> <tr> <th>column 1</th> <th>column 2</th> </tr> <?php $sites = array_map('trim',file('websites.txt')); //read the whole file into an array & trim the newline character from the end of each line foreach ($sites as $link) { echo "<tr><td><a href='$link'>$link</a></td>"; } $sites = array_map('trim',file('websites2.txt')); //read the whole file into an array & trim the newline character from the end of each line foreach ($sites as $link) { echo "<td><a href='$link'>$link</a></td></tr>"; } ?> </table> hello. im having trouble putting an if statment in my loop this is my loop. Code: [Select] <div id="ddtabs3" class="solidblockmenu"> <ul> <?PHP foreach($topNav as $topNavs): ?> <li><a href="<?PHP echo $topNavs->title; ?>.php" id="<?PHP echo $topNavs->title; ?>"><?PHP echo $topNavs->title; ?></a></li> <?PHP endforeach; ?> </ul> </div><!-- #ddtabs3--> i what to add an if $pageName = '$topNavs->title'; then <li class = selected> any ideas thanks rick I have a dropdown menu <td width="148" height="35" valign="top"><b>Type: </b> </td> <td><select name ="tabledrop"> <option value="goggles">goggles</option> <option value="headbands">headbands</option> <input type='hidden' id='tabledrop' name='tabledrop' value = ''/> </select> </td> those 2 options are actually names of my tables. I tried this and got some syntax error. $type = $_POST['tabledrop']; $item = $_POST['goggles_name']; $price = $_POST['goggles_price']; $file = $_FILES['goggles_image']['name']; $query = "INSERT into $type SET [$type]_name = '$item' , [$type]_price = '$price' , [$type]_image = '$file'"; OK so i am having a little trouble putting guilds in my game, everything shows up but when you go to create a new guild it say can not update player stats, but it shows up that the guild has been created in the top guild list, it just doesnt let you use it here is the script could someone tell me if they see a problem Code: [Select] <?php require 'connect.php'; include 'header.php'; include 'headin.php'; ?> <script type="text/javascript"> function stats() { var no=document.getElementById("Name") var option=no.options[no.selectedIndex].value var y="guild.php?stats=1&&guild="+option window.open(y,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=400, height=500") } function redirect() { window.location="./guild.php" } </script> <?php if(!isset($_COOKIE['member_id'])) die('Not logged in, please <a href=login.php>login</a>'); $Player=$_COOKIE['member_id']; $Option=$_POST['option']; $Create=$_POST['create']; $Join=$_POST['join']; $Submit=$_POST['submit']; $Tax=$_POST['tax']; $Guild=$_GET['guild']; $Deny=$_GET['deny']; $Add=$_GET['add']; $Stats=$_GET['stats']; $Kick=$_GET['kick']; $Kickname=$_GET['kickname']; $Addname=$_GET['addname']; $Abandon=$_POST['abandon']; $Coleader=$_GET['coleader']; if(isset($Abandon)) $Option="Abandon"; if($Option=="") $Option=$_GET['option']; if(isset($Option)) { if($Option=='Create a guild') { ?> <p>It costs 1,000,000 gold to create a Guild.<br /><br /></p> <form method="post" action="guild.php"> Name:<input class="text" type="text" name="name" /> <input class="button" name="create" type="submit" value="submit" /> </form> <?php } elseif($Option=='Join a guild') { print "<form class=\"form\" action='guild.php' method='post'>"; print "<select class=\"select\" name='Name' id='Name' length='20' id='blah'>"; $Guild="SELECT * from Guilds order by ID asc"; $Guild2=mysql_query($Guild) or die("Could not select Guilds"); while ($Guild3=mysql_fetch_array($Guild2)) { $Name=str_replace(" ","%20",$Guild3['Name']); print "<option value=\"$Name\">$Guild3[Name]</option>"; } print "</select><br />"; print "<input class=\"button\" type='Submit' name='join' value='Join' /> "; ?><input class=button type="button" onclick="stats()" value="Stats" /></form> <?php } elseif($Option=='Raise your guilds tax') { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); if($Guild['Tax']>90){ mysql_query("UPDATE Guilds SET Tax='90' WHERE Name='$Name'"); } if($Guild['Owner']==$User['Playername'] || $Guild['Coleader']==$User['Playername']){ print "<form class=\"form\" action='guild.php' method='post'>"; print "Amount: <input type=text class=\"select\" name='tax' id='tax' length='3' id='tax'>"; print "<br /><br>"; print "<input class=\"button\" type='Submit' name='submit' value='Raise' /></form> "; }else{ echo"You may not edit your Guild Tax, since you are not a leader or co-leader."; exit; } } elseif($Option=='Guild stats') { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Guild1="SELECT * from Guilds where Name='$User[Guild]'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); $Query="SELECT * from Users where Guild='$Guild[Name]' order by Level desc"; $Query2=mysql_query($Query) or die("Could not get user stats"); if($Guild['Name']!="") { print "<table class=\"table\" align=\"center\"><tr><td>"; $AttackPower=number_format(pow($Guild['AttackPower']+10, 5)); $DefenceStance=number_format(pow($Guild['DefenceStance']+10, 5)); $Agility=number_format(pow($Guild['Agility']+10, 5)); $Gold=pow($Guild['Gold']+12,3)*4; $Gold=number_format($Gold); $Exp=pow($Guild['Exp']+9, 4)+500; $Exp=number_format($Exp); $Itemfind=number_format(pow($Guild['Itemfind']+10, 5)); $Itemquality=number_format(pow($Guild['Itemquality']+10, 5)); print "Guild Name: $Guild[Name]<br />Guild Owner: $Guild[Owner]<br />Guild Co-Owner: $Guild[Coleader]<br />Guild Bank: $Guild[Bank]<br />Guild Tax: $Guild[Tax]%<br />Last Guild Battle: $Guild[LastFight]<br />Battles won: $Guild[Won]<br />Battles Lost: $Guild[Lost]<br />"; if($Guild['Owner']==$User['Playername'] || $Guild['Coleader']==$User['Playername'] || $User['Admin']==1){ echo "<form class=\"form\" method=\"post\" action=\"guildbonus.php\">"; echo "Attack Power:".$Guild['AttackPower']."% <input class=\"button\" type='Submit' name='AttackPower' value='Increase' /> $AttackPower gold<br />"; echo "Defence Stance:".$Guild['DefenceStance']."% <input class=\"button\" type='Submit' name='DefenceStance' value='Increase' /> $DefenceStance gold<br />"; echo "Agility:".$Guild['Agility']."% <input class=\"button\" type='Submit' name='Agility' value='Increase' /> $Agility gold<br />"; echo"Exp:".$Guild['Exp']."% <input class=\"button\" type='Submit' name='Exp' value='Increase' /> $Exp gold<br />"; echo "Gold:".$Guild['Gold']."% <input class=\"button\" type='Submit' name='Gold' value='Increase' /> $Gold gold<br />"; echo "Item Find:".$Guild['Itemfind']."% <input class=\"button\" type='Submit' name='Itemfind' value='Increase' /> $Itemfind gold<br />"; echo "Item Quality:".$Guild['Itemquality']."% <input class=\"button\" type='Submit' name='Itemquality' value='Increase' /> $Itemquality gold<br />"; }else{ echo "<form class=\"form\" method=\"post\" action=\"guildbonus.php\">"; echo "Attack Power:".$Guild['AttackPower']."% <br />"; echo "Defence Stance:".$Guild['DefenceStance']."% <br />"; echo "Agility:".$Guild['Agility']."% <br />"; echo "Experience".$Guild['Exp']."% <br />"; echo "Gold:".$Guild['Gold']."% <br />"; echo "Item Find:".$Guild['Itemfind']."% <br />"; echo "Item Quality:".$Guild['Itemquality']."% <br />"; } print "Donate:<input class=\"text\" type=\"text\" name=\"Amount\" value=\"$User[Gold]\" /><input class=\"button\" type='Submit' name='Donate' value='Donate' /></form><br />"; if($User['Playername']==$Guild['Owner']||$User['Playername']==$Guild['Coleader']||$Player=="1"){ print"<a href=\"attackguild.php\">Attack Other Guilds</a><br><br>"; } if($User['Playername']==$Guild['Owner']||$User['Playername']==$Guild['Coleader']||$Player=="1") { $Name=str_replace(" ","%20",$Guild['Name']); echo "<a href=\"guild.php?coleader=1&&Guild=$Name\">Assign coleader</a><br />"; } print "</td></tr></table>"; } else echo "You are not in a guild, below is a listing of all people not in a guild."; print "<table class=\"table\" align=\"right\"><tr><td>"; print "<form class=\"form\" action='guild.php' method='post'>"; print "<table><tr><td>"; print "Members:<br />To kick a member out the guild must pay half of what the User has donated.<br><br><table id=\"table\"><tr><td>Player</td><td>Level</td><td>Donated</td>"; if($User['Playername']==$Guild['Owner']||$User['Playername']==$Guild['Coleader']||$Player=="1"){ print "<td>Kick</td>"; } print "</tr>"; while($topplayer3=mysql_fetch_array($Query2)) { print "<tr><td>$topplayer3[Playername]</td><td>$topplayer3[Level]</td><td>$topplayer3[GuildDonate]</td>"; if($User['Playername']==$Guild['Owner']||$User['Playername']==$Guild['Coleader']||$Player=="1"){ print "<td><a href=\"guild.php?kick=$topplayer3[ID]&&kickname=$Guild[ID]\">Kick</a></td>"; } print "</tr>"; } print "</table></form></td><td></td><td>"; if($User['Playername']==$Guild['Owner']||$User['Playername']==$Guild['Coleader']||$Player=="1") { $Name = $Guild['Name']; $Guild['Name' ]= str_replace(" ","%20",$Guild['Name']); $Query = mysql_query("select * from Users where Applied='$Name'"); print "Requests:<br /><table id=\"table\"><tr><td>Name</td><td>Level</td><td>Accept?</td><td>Deny?</td></tr>"; while($joinee = mysql_fetch_array($Query)) { echo "<tr><td>$joinee[Playername]</td>"; echo "<td>$joinee[Level]</td>"; echo "<td><a href=\"guild.php?add=$joinee[ID]&&addname=$Guild[Name]\">Accept</a></td><td><a href=\"guild.php?deny=$joinee[ID]\">Deny</a></td></tr>"; } print "</table>"; print "</td></tr></table>"; } print "</td></tr></table><br />"; } elseif($Option=='Leave guild') { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); if($Guild['Owner']==$User['Playername']) { echo "Are you sure you want to abandon and delete your guild?"; echo "<form action=\"guild.php\" method=\"post\"><input type=\"hidden\" value=\"$Guild[Name]\" name=\"Guild\" /><input class=\"button\" type=\"submit\" name=\"abandon\" value=\"yes\" /><input class=\"button\" type=\"button\" value=\"no\" onclick=\"redirect()\" /></form>"; } else { mysql_query("UPDATE Users SET GuildDonate='0' WHERE ID='$Player'"); mysql_query("Update Users set Guild='' where ID='$Player'") or die("Could not update player stats"); mysql_query("update Guilds set Members=Members-'1' where Name='$Guild[Name]'") or die("Could not decrease number of members"); print "You have left the guild."; } } elseif($Option=="Abandon") { $Guild=$_POST['Guild']; $Query="Select * from Users where Guild='$Guild'"; $Query2=mysql_query($Query) or die("Zomg"); while($User=mysql_fetch_array($Query2)) { $ID=$User['ID']; $Update="Update Users set Guild='' where ID='$ID'"; mysql_query($Update) or die("No clan update."); } $Query="Delete from Guilds where Name='$Guild'"; mysql_query($Query) or die("Can't delete guild."); echo "Clan deleted."; } } elseif(isset($Kick)) { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Querty="SELECT * from Users where ID='$Kick'"; $Querty2=mysql_query($Querty) or die("Could not get user stats"); $Kicking=mysql_fetch_array($Querty2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); $KickAmount=$Kicking['GuildDonate']/2; if($User['Playername']!=$Guild['Owner'] AND $User['Playername']!=$Guild['Coleader'] AND $User['Admin']!=1){ echo"You cannot kick users because you are not the leader or coleader of this guild!"; exit; } elseif($Kicking['Playername']==$Guild['Owner']){ echo"You may not kick out the creator of this guild!"; exit; } elseif($KickAmount>$Guild['Bank']){ echo"You do not have enough gold to kick this player out. To kick out a member you must be able to pay half of what they have donated."; exit; } else{ mysql_query("UPDATE Guilds SET Bank=Bank-'$KickAmount' WHERE ID='$Kickname'"); mysql_query("UPDATE Guilds SET Members=Members-'1' WHERE Name='$Guild[Name]'"); mysql_query("UPDATE Users SET Gold=Gold'$KickAmount' WHERE ID='$Kick'"); mysql_query("UPDATE Users SET GuildDonate='0' WHERE ID='$Kick'"); mysql_query("UPDATE Users SET Guild='' WHERE ID='$Kick'"); echo"Player kicked from your guild! <a href='guild.php'>Back</a>"; } } elseif(isset($Submit)) { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); if($Tax<0 || $Tax>90){ echo"Do you want people leaving your guild?"; exit; }else{ mysql_query("Update Guilds set Tax='$Tax' where Name='$Name'"); echo "Tax set to $Tax!"; } } elseif(isset($Create)) { if(isset($_POST['name'])) { $Name=$_POST['name']; $Player=$_COOKIE['member_id']; $Query=mysql_query("select * from Users where ID='$Player'") or die("Could not query Users"); $User=mysql_fetch_array($Query); $check="SELECT * from Guilds where Name='$Name'"; $check2=mysql_query($check) or die("Could not query guilds"); while($check3=mysql_fetch_array($check2)) { $Clan=$check3['Name']; } if($Clan) print "Sorry there is already a guild of that name."; elseif($User['Guild'] != "") echo "You have to leave your clan before you can create your own."; elseif($User['Gold']>=1000000) { $Query="INSERT into Guilds(Name, Owner) VALUES ('$Name', '$User[Playername]')"; mysql_query($Query) or die("could not create clan"); $Update="Update Users set Guild='$Name', Applied='', Gold=Gold-'1000000' where ID='$Player'"; mysql_query($Update) or die("Could not update player stats"); print "Clan created."; } else print "You do not have enough gold."; } } elseif(isset($Join)) { if(isset($_POST['Name'])) { $Name=$_POST['Name']; $Player=$_COOKIE['member_id']; $Name=str_replace("%20"," ",$Name); $Query=mysql_query("SELECT * FROM Guilds where Name='$Name'") or die("Could not fetch guild stats"); $Guild=mysql_fetch_array($Query); $Query=mysql_query("Select * from Users where ID='$Player'"); $User=mysql_fetch_array($Query); if($User['Guild'] != "") echo "Leave your other guild first before you join a new one.<br /><a href=\"guild.php\">Go back</a>"; elseif($Guild[Members]==15){ echo "Guild is full, sorry, go pick another. <a href=fight.php>Go</a>"; }else { mysql_query("update Users set Applied='$Name' where ID='$Player'"); if($Guild['Members'] >= 15) echo "You are accepted, but the guild is currently full. you may have to wait an extended amount of time before you are accepted."; else echo "You applied for the clan. Now wait until either the owner or the coleader accepts you."; } } } elseif(isset($Deny)){ $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); if($User['Playername']!=$Guild['Owner'] AND $User['Playername']!=$Guild['Coleader'] AND $User['Admin']!=1){ echo"You cannot deny users because you are not the leader or coleader of this guild!"; exit; }else{ $Update="Update Users set Applied='' where ID='$Deny'"; mysql_query($Update) or die("Could not update player stats"); print "Player denied.<br /><a href=\"guild.php\">Go back</a>"; } } elseif(isset($Add)) { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Name=$User['Guild']; $Guild1="SELECT * from Guilds where Name='$Name'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); if($User['Playername']!=$Guild['Owner'] AND $User['Playername']!=$Guild['Coleader'] AND $User['Admin']!=1){ echo"You cannot add users because you are not the leader or coleader of this guild!"; exit; }else{ $Addname=str_replace("%20"," ",$Addname); $Query=mysql_query("SELECT * from Guilds where Name='$Addname'") or die("Could not get guild stats"); $Guild=mysql_fetch_array($Query); if($Guild['Members'] <= 15) { $Query2=mysql_query("SELECT * FROM Users where ID='$Add'") or die("Could not get player stats"); $User=mysql_fetch_array($Query2); mysql_query("Update Guilds set Members=Members+'1' where Name='$Addname'") or die("Could not update guilds"); $Update="Update Users set Guild='$Addname', Applied='' where ID='$Add'"; mysql_query($Update) or die("Could not update player stats"); print "Player accepted.<br /><a href=\"guild.php?option=Guild%20stats\">Go back</a>"; } else print "Clan is full, cannot accept player.<br /><a href=\"guild.php?option=Guild%20stats\">Go back</a>"; } } elseif(isset($Guild)) { $Query="SELECT * from Guilds where Name='$Guild'"; $Query2=mysql_query($Query) or die("Could not get guild stats"); $Guild=mysql_fetch_array($Query2); $Query3="SELECT * from Users where Guild='$Guild[Name]'"; $Query4=mysql_query($Query3) or die("Could not get user stats"); print "Guild name: $Guild[Name]<br />Guild Owner: $Guild[Owner]<br />Clan bank: $Guild[Bank]<br />"; echo "Exp:".number_format($Guild['Exp'])."%<br />"; echo "Gold:".number_format($Guild['Gold'])."%<br />"; print "Members:<br /><table id=\"table\"><tr><td>Player</td><td>Level</td></tr>"; while($topplayer3=mysql_fetch_array($Query4)) { print "<tr><td>$topplayer3[Playername]</td><td>$topplayer3[Level]</td></tr>"; } print "</table>"; } elseif($Coleader==1) { $Guild=str_replace("%20"," ",$_GET['Guild']); $Query="SELECT * from Users where Guild='$Guild' order by Level desc"; $Query2=mysql_query($Query) or die("Could not get user stats"); $Guild1="SELECT * from Guilds where Name='$Guild'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); print "<table><tr><td>"; print "Members:<br /><table id=\"table\"><tr><td>Player</td><td>Level</td></tr>"; while($Member=mysql_fetch_array($Query2)) { if($Member['Playername']!=$Guild['Owner']) { $Name=str_replace(" ","%20",$Member['Playername']); $Guild=str_replace(" ","%20",$_GET['Guild']); print "<tr><td><a href=\"guild.php?coleader=$Name&&Guild=$Guild\">$Member[Playername]<a></td><td>$Member[Level]</td></tr>"; } } print "</table><br /><a href=\"guild.php?option=Guild%20stats\">Go back</a>"; } elseif($Coleader) { $Name=str_replace("%20"," ",$Coleader); $Guild=$_GET['Guild']; $Query="Update Guilds set Coleader='$Name' where Name='$Guild'"; mysql_query($Query) or die("Could not set coleader."); echo "Coleader assigned. <a href=\"guild.php?option=Guild%20stats\">Go back</a>"; } else { $Query="SELECT * from Users where ID='$Player'"; $Query2=mysql_query($Query) or die("Could not get user stats"); $User=mysql_fetch_array($Query2); $Guild1="SELECT * from Guilds where Name='$User[Guild]'"; $Guild2=mysql_query($Guild1) or die("Could not select Guilds"); $Guild=mysql_fetch_array($Guild2); print"<form method=\"post\" action=\"guild.php\">"; print"<select class=\"select\" name=\"option\">"; if($Guild['Name']!=""){ print"<option>Guild stats</option>"; print"<option>Raise your guilds tax</option>"; print"<option>Leave guild</option>"; }else{ print"<option>Create a guild</option>"; print"<option>Join a guild</option>"; } print"</select>"; print"<input class=\"button\" type=\"submit\" value=\"submit\" name=\"guild\">"; print"</form>"; print"</body>"; } ?> Hi! Im in need of some help. I had a form built for me and im attempting to make it so some details are required eg name, cc number etc. But i cannot figure out how to do it. I only have dreamweaver cs4 and i attempted to do it through that but when i uploaded the form it didnt work. The form is located he https://eatatmenzies.com.au/catering_menu.php and my code it as follows [[code]<?php $teaandcoffee=$_POST['teaandcoffee']; $teaandcoffeeallday=$_POST['teaandcoffeeallday']; $orangejuice=$_POST['orangejuice']; $mineralwater=$_POST['mineralwater']; $cookies=$_POST['cookies']; $slices=$_POST['slices']; $minimuffins=$_POST['minimuffins']; $texanmuffins=$_POST['texanmuffins']; $bananaorcarrotcake=$_POST['bananaorcarrotcake']; $minidanishes=$_POST['minidanishes']; $assprtedsandwhiches4points=$_POST['assprtedsandwhiches4points']; $assortedsandwhiches6points=$_POST['assortedsandwhiches6points']; $c1=$_POST['c1']; $c2=$_POST['c2']; $c3=$_POST['c3']; $c4=$_POST['c4']; $c5=$_POST['c5']; $Tandoorichickenskewers=$_POST['Tandoorichickenskewers']; $Californiasushirolls=$_POST['Californiasushirolls']; $Thaiprawnskewers=$_POST['Thaiprawnskewers']; $Roastedvegetablefrittata=$_POST['Roastedvegetablefrittata']; $Vegetablesamosas=$_POST['Vegetablesamosas']; $Smokedsalmontarts=$_POST['Smokedsalmontarts']; $Cocktailspringrolls=$_POST['Cocktailspringrolls']; $DimSims=$_POST['DimSims']; $c6=$_POST['c6']; $Beefsatay=$_POST['Beefsatay']; $Orangeandhoneydrumsticks=$_POST['Orangeandhoneydrumsticks']; $Antipastoplatter=$_POST['Antipastoplatter']; $Roastedvegandcumincouscous=$_POST['Roastedvegandcumincouscous']; $Coleslaw=$_POST['Coleslaw']; $Potatoandeggsaladwithchives=$_POST['Potatoandeggsaladwithchives']; $Basilandcherrytomatofusilli=$_POST['Basilandcherrytomatofusilli']; $greensalad=$_POST['greensalad']; $ceasarsalad=$_POST['ceasarsalad']; $freshfruitsaad=$_POST['freshfruitsaad']; $breadrollsandbutter=$_POST['breadrollsandbutter']; $freshseasonalfruitplatter=$_POST['freshseasonalfruitplatter']; $cheeseplatter=$_POST['cheeseplatter']; $Name=$_POST['Name']; $deliveryaddress=nl2br($_POST['deliveryaddress']); $DeliveryDate=$_POST['DeliveryDate']; $DeliveryTime=$_POST['DeliveryTime']; $ContactForm=$_POST['ContactForm']; $comments=nl2br($_POST['comments']); $totalamount=$_POST['totalamount']; $gtotalamount=$_POST['gtotalamount']; $gst=$_POST['gst']; $discount=$_POST['discount']; $ccno=$_POST['ccno1'].$_POST['ccno2'].$_POST['ccno3'].$_POST['ccno4']; $CardExpiry=$_POST['CardExpiry']; $ccv=$_POST['ccv']; if($_POST['submit_2']==1) { $ipadd=$_SERVER['REMOTE_ADDR']; $to = 'derek@eatatmenzies.com.au'; $subject = 'New Catering Order'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: mail@EatAtMenzies.com.au' . "\r\n" . 'Reply-To: mail@EatAtMenzies.com.au' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $mailbody=<<<EWURPO <table width="575" border="0" align="center" cellpadding="0" cellspacing="2"> <tbody> <tr> <td colspan="3"><h2> <hr color="#333333" noshade="noshade" size="1" /> </h2></td> </tr> <tr> <td width="284"><h1>Refreshments</h1></td> <td width="122"><p>per person<br /> </p></td> <td width="161"><p>QTY</p></td> </tr> <tr> <td><p>Tea & Coffee</p></td> <td><p>$2.50 </p></td> <td>$teaandcoffee </td> </tr> <tr> <td><p>Tea & Coffee (all day)</p></td> <td><p>$8.50</p></td> <td>$teaandcoffeeallday</td> </tr> <tr> <td><p>Orange Juice</p></td> <td><p>$2.50</p></td> <td>$orangejuice</td> </tr> <tr> <td><p>Mineral Water</p></td> <td><p>$2.00</p></td> <td>$mineralwater</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Morning & Afternoon Tea</h1></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Cookies</p></td> <td><p>$2.50 </p></td> <td><p> $cookies </p></td> </tr> <tr> <td><p>Slices</p></td> <td><p>$3.00</p></td> <td>$slices</td> </tr> <tr> <td><p>Muffins (mini)</p></td> <td><p>$1.50</p></td> <td>$minimuffins</td> </tr> <tr> <td><p>Muffins (Texan)</p></td> <td><p>$3.00</p></td> <td>$texanmuffins</td> </tr> <tr> <td valign="top"><p>Banana or Carrot cake</p></td> <td valign="top"><p>$2.50</p></td> <td valign="top">$bananaorcarrotcake</td> </tr> <tr> <td><p>Mini Danishes</p></td> <td><p>$1.50</p></td> <td>$minidanishes</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Sandwich Platters</h1></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Assorted sandwiches (4 points)</p></td> <td><p>$5.00 </p></td> <td> $assprtedsandwhiches4points</td> </tr> <tr> <td><p>Assorted sandwiches (6 points)</p></td> <td><p>$6.80 per person</p></td> <td> $assortedsandwhiches6points</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Finger Food Platters</h1></td> <td colspan="2">� <p>per person<br /> </p></td> </tr> <tr> <td colspan="3"><p>Items listed below are based on 2 pieces per serve (minimum 8 people)</p></td> </tr> <tr> <td> </td> <td> </td> <td><p>QTY</p></td> </tr> <tr> <td><p>Caramalised onion & goats cheese tarts (V)</p></td> <td><p>$1.50 </p></td> <td>$c1</td> </tr> <tr> <td><p>Mini cottage pies</p></td> <td><p>$2.00</p></td> <td>$c2</td> </tr> <tr> <td><p>Canap�s with tomato & basil salsa (V)</p></td> <td><p>$1.20</p></td> <td>$c3</td> </tr> <tr> <td><p>Canap�s with smoked salmon and cream cheese</p></td> <td><p>$1.80</p></td> <td>$c4</td> </tr> <tr> <td><p>Home made sausage rolls</p></td> <td><p>$1.60</p></td> <td>$c5</td> </tr> <tr> <td><p>Tandoori chicken skewers</p></td> <td><p>$2.00</p></td> <td> $Tandoorichickenskewers </td> </tr> <tr> <td><p>California sushi rolls</p></td> <td><p>$1.80</p></td> <td>$Californiasushirolls</td> </tr> <tr> <td><p>Thai prawn skewers</p></td> <td><p>$2.60</p></td> <td>$Thaiprawnskewers</td> </tr> <tr> <td><p>Roasted vegetable frittata</p></td> <td><p>$1.80</p></td> <td>$Roastedvegetablefrittata</td> </tr> <tr> <td><p>Vegetable samosas</p></td> <td><p>$1.50</p></td> <td>$Vegetablesamosas</td> </tr> <tr> <td><p>Smoked salmon tarts</p></td> <td><p>$1.80</p></td> <td>$Smokedsalmontarts</td> </tr> <tr> <td><p>Cocktail spring rolls</p></td> <td><p>$1.50</p></td> <td>$Cocktailspringrolls</td> </tr> <tr> <td><p>Dim Sims<br /> </p></td> <td><p>$1.50</p></td> <td>$DimSims</td> </tr> <tr> <td><p>Cheese & sun dried tomato puffs (V)</p></td> <td><p>$1.30</p></td> <td>$c6</td> </tr> <tr> <td><p>Beef satay</p></td> <td><p>$2.00</p></td> <td>$Beefsatay</td> </tr> <tr> <td><p>Orange and honey drumsticks</p></td> <td><p>$2.50</p></td> <td>$Orangeandhoneydrumsticks</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Antipasto Platter</h1></td> <td valign="top"><p>$8.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$Antipastoplatter</td> </tr> <tr> <td colspan="3"><p>Including: Olives, prosciutto, salami, pesto salad with bocconcini and tomato & roasted red capsicum</p></td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Salads</h1></td> <td colspan="2"><br /></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p>per person<br /> </p></td> <td><p>QTY</p></td> </tr> <tr> <td><p>Roasted veg and cumin cous cous</p></td> <td><p>$2.50 </p></td> <td> $Roastedvegandcumincouscous</td> </tr> <tr> <td><p>Coleslaw</p></td> <td><p>$2.50</p></td> <td>$Coleslaw</td> </tr> <tr> <td><p>Potato and egg salad with chives</p></td> <td><p>$2.50</p></td> <td> $Potatoandeggsaladwithchives </td> </tr> <tr> <td><p>Basil and cherry tomato fusilli</p></td> <td><p>$2.50</p></td> <td>$Basilandcherrytomatofusilli</td> </tr> <tr> <td><p>Green salad</p></td> <td><p>$2.50</p></td> <td>$greensalad</td> </tr> <tr> <td><p>Caesar Salad</p></td> <td><p>$3.00</p></td> <td>$ceasarsalad</td> </tr> <tr> <td><p>Fresh fruit salad</p></td> <td><p>$3.80</p></td> <td>$freshfruitsaad</td> </tr> <tr> <td><p>Bread rolls and butter</p></td> <td><p>$1.00</p></td> <td>$breadrollsandbutter</td> </tr> <tr> <td height="50"><br /></td> <td colspan="2"><br /></td> </tr> <tr> <td><h1>Fresh Seasonal Fruit Platter</h1></td> <td valign="top"><p>$5.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$freshseasonalfruitplatter</td> </tr> <tr> <td height="25"><p><br /> </p></td> <td colspan="2"><p><br /> </p></td> </tr> <tr> <td><h1>Cheese Platter</h1></td> <td valign="top"><p>$5.00 per person</p></td> <td valign="top"><p>QTY</p></td> </tr> <tr> <td><p>(minimum 4 people)</p></td> <td><p><br /> </p></td> <td>$cheeseplatter</td> </tr> <tr> <td colspan="3"><p>A soft, a cheddar and a blue, served with fresh grapes & biscuits</p></td> </tr> <tr> <td colspan="3"><br /></td> </tr> </tbody> </table> <table width="575" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="156"><p>Name:</p></td> <td width="419"><p> $Name </p></td> </tr> <tr> <td width="156"><p>Credit Card Number:</p></td> <td width="419"><p> $ccno </p></td> </tr> <tr> <td width="156"><p>Card Expiry:</p></td> <td width="419"><p> $CardExpiry </p></td> </tr> <tr> <td width="156"><p>Card Expiry:</p></td> <td width="419"><p> $ccv </p></td> </tr> <tr> <td><p>Delivery Address:</p></td> <td><p> $deliveryaddress </p></td> </tr> <tr> <td><p>Delivery Date:</p></td> <td><p> $DeliveryDate </p></td> </tr> <tr> <td><p>Aprrox Delivery Time:</p></td> <td><p> $DeliveryTime </p></td> </tr> <tr> <td><p>Contact Number:</p></td> <td><p> $ContactForm </p></td> </tr> <tr> <td><p>Comments:</p></td> <td>$comments</td> </tr> <tr> <td> </td> <td><h1>Sub Total: $totalamount</h1></td> </tr> <tr> <td> </td> <td><h1>Discounts: $discount</h1></td> </tr> <tr> <td> </td> <td><h1>GST: $gst</h1></td> </tr> <tr> <td> </td> <td><h1>Grand Total: $gtotalamount</h1></td> </tr> </table> <br /><br /> This form was submitted by this IP ($ipadd) EWURPO; mail($to, $subject, $mailbody, $headers); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Eat @ Menzies - Catering menu - Order Online</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #CCC; } #wrapper #container #content #menu table tr td #MenuBar2 li a{ color: #000; } #wrapper #container #content #menu table tr td #MenuBar2 li a:hover{ color: #FFF; } --> </style></head> <body> <div id="wrapper"> <div id="container"> <div id="logo"><a href="index.html"><img src="images/logo.jpg" alt="eat at menzies" width="360" height="139" border="0" longdesc="http://www.eatatmenzies.com.au" /></a></div> <div id="content"> <div id="menu"> <table width="573" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" height="67" align="center"> </td> <td width="59" align="center"><a href="index.html">Home</a></td> <td width="57" align="center"><a href="menu.html">Menu</a></td> <td width="69" align="center"><a href="the_toad.html">The Toad</a></td> <td width="156" align="center">Catering & Functions</td> <td width="158" align="center"><a href="meal_plans.html">Resident Meal Plans</a></td> <td width="54" align="center"><a href="contact.html">Contact</a></td> <td width="14" align="center"> </td> </tr> </table> </div> <div id="left_content"> <p>Menzies College<br /> La Trobe University<br /> Bundoora, 3086</p> <p>Tel: 03 9479 3289<br /> Email: mail@EatAtMenzies.com.au</p> </div> <div id="right_content"><form method="post" action="catering_menu.php"> <table width="696" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="images/right_top.jpg" width="696" height="51" /></td> </tr> <tr> <td bgcolor="#FFFFFF"><table width="690" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28"> </td> <td width="644"><h1>Catering Menu & Order Form</h1> <p> </p> <p><strong>Your catering order was submitted successfully. <br /> To contact us, please email</strong> <a href="mailto:mail@EatAtMenzies.com.au">mail@EatAtMenzies.com.au</a> <strong>or call 9479 3289.</strong></p> <p><strong>Free delivery within campus for orders over $50.00. <br /> Prices are subject to change without further notice.</strong></p> <p><strong><br /> </strong></p> <p> </p></td> <td width="18"> </td> </tr> </table></td> </tr> <tr> <td><img src="images/right_bottom.jpg" width="696" height="68" /></td> </tr> </table> </form> </div> <div id="footer"><a href="http://www.tizzbizzdesign.com.au">Wesbite By Tizz Bizz Design</a></div> </div> </div> </div> </body> </html> <?} else {?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Eat @ Menzies - Catering menu - Order Online</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #CCC; } #wrapper #container #content #menu table tr td #MenuBar2 li a{ color: #000; } #wrapper #container #content #menu table tr td #MenuBar2 li a:hover{ color: #FFF; } --> </style> <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="container"> <div id="logo"><a href="index.html"><img src="images/logo.jpg" alt="eat at menzies" width="360" height="139" border="0" longdesc="http://www.eatatmenzies.com.au" /></a></div> <div id="content"> <div id="menu"> <table width="573" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="7" height="67" align="center"> </td> <td align="center"><table border="0" cellspacing="0" cellpadding="12"> <tr> <td><a href="index.html">Home</a></td> <td><a href="menu.html">Menu</a></td> <td><a href="the_toad.html">The Toad</a></td> <td>Catering & Functions</td> <td><a href="meal_plans.html">Resdient Meal Plans</a></td> <td><a href="contact.html">Contact</a></td> </tr> </table></td> <td width="12" align="center"> </td> </tr> </table> </div> <div id="left_content"> <p>Menzies College<br /> La Trobe University<br /> Bundoora, 3086</p> <p>Tel: 03 9479 3289<br /> Email: mail@EatAtMenzies.com.au</p> </div> <div id="right_content"> <form name="cform" method="post" action="catering_menu.php"> <input type="hidden" name="teaandcoffee" value="<?=$teaandcoffee?>" /> <input type="hidden" name="teaandcoffeeallday" value="<?=$teaandcoffeeallday?>" /> <input type="hidden" name="orangejuice" value="<?=$orangejuice?>" /> <input type="hidden" name="mineralwater" value="<?=$mineralwater?>" /> <input type="hidden" name="cookies" value="<?=$cookies?>" /> <input type="hidden" name="slices" value="<?=$slices?>" /> <input type="hidden" name="minimuffins" value="<?=$minimuffins?>" /> <input type="hidden" name="texanmuffins" value="<?=$texanmuffins?>" /> <input type="hidden" name="bananaorcarrotcake" value="<?=$bananaorcarrotcake?>" /> <input type="hidden" name="minidanishes" value="<?=$minidanishes?>" /> <input type="hidden" name="assprtedsandwhiches4points" value="<?=$assprtedsandwhiches4points?>" /> <input type="hidden" name="assortedsandwhiches6points" value="<?=$assortedsandwhiches6points?>" /> <input type="hidden" name="c1" value="<?=$c1?>" /> <input type="hidden" name="c2" value="<?=$c2?>" /> <input type="hidden" name="c3" value="<?=$c3?>" /> <input type="hidden" name="c4" value="<?=$c4?>" /> <input type="hidden" name="c5" value="<?=$c5?>" /> <input type="hidden" name="c6" value="<?=$c6?>" /> <input type="hidden" name="Tandoorichickenskewers" value="<?=$Tandoorichickenskewers?>" /> <input type="hidden" name="Californiasushirolls" value="<?=$Californiasushirolls?>" /> <input type="hidden" name="Thaiprawnskewers" value="<?=$Thaiprawnskewers?>" /> <input type="hidden" name="Roastedvegetablefrittata" value="<?=$Roastedvegetablefrittata?>" /> <input type="hidden" name="Vegetablesamosas" value="<?=$Vegetablesamosas?>" /> <input type="hidden" name="Smokedsalmontarts" value="<?=$Smokedsalmontarts?>" /> <input type="hidden" name="Cocktailspringrolls" value="<?=$Cocktailspringrolls?>" /> <input type="hidden" name="DimSims" value="<?=$DimSims?>" /> <input type="hidden" name="Beefsatay" value="<?=$Beefsatay?>" /> <input type="hidden" name="Orangeandhoneydrumsticks" value="<?=$Orangeandhoneydrumsticks?>" /> <input type="hidden" name="Antipastoplatter" value="<?=$Antipastoplatter?>" /> <input type="hidden" name="Roastedvegandcumincouscous" value="<?=$Roastedvegandcumincouscous?>" /> <input type="hidden" name="Coleslaw" value="<?=$Coleslaw?>" /> <input type="hidden" name="Potatoandeggsaladwithchives" value="<?=$Potatoandeggsaladwithchives?>" /> <input type="hidden" name="Basilandcherrytomatofusilli" value="<?=$Basilandcherrytomatofusilli?>" /> <input type="hidden" name="greensalad" value="<?=$greensalad?>" /> <input type="hidden" name="ceasarsalad" value="<?=$ceasarsalad?>" /> <input type="hidden" name="freshfruitsaad" value="<?=$freshfruitsaad?>" /> <input type="hidden" name="breadrollsandbutter" value="<?=$breadrollsandbutter?>" /> <input type="hidden" name="freshseasonalfruitplatter" value="<?=$freshseasonalfruitplatter?>" /> <input type="hidden" name="cheeseplatter" value="<?=$cheeseplatter?>" /> <input type="hidden" name="gtotalamount" value="<?=$gtotalamount?>" /> <input type="hidden" name="totalamount" value="<?=$totalamount?>" /> <input type="hidden" name="discount Hi guys, I've got quite a few fields in my tables that i've serialised to keep the number of fields down. For everything else that works perfect as it stores the data and when needed I can use the following as an example: $dateofbirth = unserialize($row['dateofbirth']); $dobday = $dateofbirth[0]; $dobmonth = $dateofbirth[1]; $dobyear = $dateofbirth[2]; Date of birth is stored as dd,mm,yyyy and for everything else I can call it fine. My issue is now that i'm trying to use fputcsv to create a csv file using the following: $result = mysqli_query($con, 'SELECT u.user_id, b.dateofbirth FROM Users u INNER JOIN Basic b USING (user_id) ORDER BY user_id DESC'); $fp = fopen('latest.csv', 'w'); fputcsv($fp, array('User ID', 'DOB' )); The CSV generates, but for the date of birth column in the csv it outputs as "a:3:{i:0;s:2:"03";i:1;s:2:"02";i:2;s:4:"1986";}" because it's obviously still serialised. What is my best and or easiest way of handling these fields? Many thanks in advance. Edited by Kristoff1875, 21 January 2015 - 05:24 AM. |