PHP - Oo Coding Explaination Required
Hey, I'm finally getting around to teaching myself OO PHP, I been working on a database connetcion class and based it on a tutorial I found on the net. However, it doesn't explain it too well can anyone help me please.
I know what is going on right up until " $this->_database_connection" and "$this->_database_connection_select", at first I had the coding as "$this->databaseConnection = mysql_pconnect($this->databaseHostname, $this->databaseUsername, $this->databasePassword) or trigger_error(mysql_error(),E_USER_ERROR);" because I thought it was saysing the this function database connection should connect to the mysql database using these variables. But it didn't seem to working, got it fixed now using after looking at the tutorial but there is no explaination to why this works and mine didn't. I understand that databaseHostname for example is being defined by the object, on the third bit of coding. Actually thinking about it, have I also defined in the first bit of coding. I haven't included the SQL statement that retrives data, just so you know. If anyone can help I will greatly appericate it Code: [Select] <?php # CONNECTION DETAILS THAT ARE THEN PASSED THROUGH TO "dbConnecxt" $databaseHostname = "localhost"; $databaseUsername = "username"; $databasePassword = "password"; $databaseName = "databasename"; ?> Code: [Select] <?php require_once ("config/config.php"); class databaseConnectionClass { public $databaseHostname; public $databaseUsername; public $databasePassword; public $databaseName; # MAIN CONNECTION TO THE DATABASE, PASSING THE public function databaseConnection($objDatabaseConnect) { $this->_database_connection = mysql_pconnect($this->databaseHostname, $this->databaseUsername, $this->databasePassword) or trigger_error(mysql_error(),E_USER_ERROR); return $this->_database_connection; } # SELECTS THE DATABASE WE WANT public function databaseConnectionSelect() { $this->_database_connection_select = mysql_select_db($this->databaseName, $this->_database_connection); return $this->_database_connection_select; } # CALL ALL THE DATABASE CONNECTION OBJECTS public function databaseConnectionProcess($objDatabaseConnect) { $objDatabaseConnect->databaseConnection($objDatabaseConnect); $objDatabaseConnect->databaseConnectionSelect($objDatabaseConnect); } # BUILDS A OBJECT METHOD public function databaseConnectionMain($objDatabaseConnect) { $objDatabaseConnect->databaseConnectionProcess($objDatabaseConnect); } } ?> Code: [Select] <?php #THIS CLASS CREATES AND OBJECT, WHICHS SETS THE OBJECT TO EQUAL THE INFO FROM "dbConnectClass.php" require_once ("dbConnectClass.php"); $objDatabaseConnect = new databaseConnectionClass(); $objDatabaseConnect->databaseHostname = $databaseHostname; $objDatabaseConnect->databaseUsername = $databaseUsername; $objDatabaseConnect->databasePassword = $databasePassword; $objDatabaseConnect->databaseName = $databaseName; $objDatabaseConnect->databaseConnectionMain($objDatabaseConnect); ?> Similar TutorialsHi All, I am new to PHP and HTML and I am trying to write an interface to MySQL 5.1 data base on Ubuntu 10.04LTS using PHP. My database has following tables 1) parts---> Part_no, Part_name--->PK is Part_no 2) operation---> Part_no,op_id--->PK is op_id, FK is Part_no 3)tool_list---->tl_id,op_id, tool---->PK is tl_id, FK is op_id 4)tool---->tool_part_no, tool_desc---->PK is tool_part_no I have many rows of data in 'tool' table. I want to referance/add these tools in to 'tool_list' table. these 'tool_list's are specific to a operatiom which once again is specific to a part. So Part_no--->op_id--->tool_list---->tool I have created 'one.php' which will aske the user for part no. This is a list which is populated from database. once the user selects the part_no and submits. it loads 'two.php' and lists operations specific to that part_no. Here once operation is selected and submited it calls 'three.php'. Here I need to add tools on to this selected operation. There can be as many as 20 different tool that can be added in to an operation. What i am looking to do is to list all tool in the 'tool' table as a list and add each tool in to the 'tool_list' table. once all tools are added press another button caled Exit which will take the user to Home page. The question is how do i accomplish this. 1) once a tool is selected it has to be added as a new row in to tool_list and the page need to be reloaded but has to remember the part_no, op_id for subsequent additions. 2) once all tools are added and exit is pressed it needs to goto home page. How do i accomplish these. Can a HTML page have two forms in it like on inside the other?. Or can this be accomplished with PHP only?. Thanks SKN Hi Buddy I'm new to Php and downloaded shopping cart for www.phpwebcommerce.com/download/plaincart.zip With this code, i'm unable to update the shopping cart. On clicking the update button, it goes to previous page. But in demo version the update is working properly. Kindly help. Thanks Sakhsen $page = (isset($_GET["page"]))?$_GET["page"] : 1 ; This is from a pagination script, and I am wondering what the ? means here, and what the : does. <?php /** * This is the model class for table "student_docs". * * The followings are the available columns in table 'student_docs': * @property integer $student_docs_id * @property string $doc_category_id * @property string $title * @property string $student_docs_desc * @property string $student_docs_path */ class StudentDocs extends CActiveRecord { /** * Returns the static model of the specified AR class. * @param string $className active record class name. * @return StudentDocs the static model class */ public static function model($className=__CLASS__) { return parent::model($className); } /** * @return string the associated database table name */ public function tableName() { return 'student_docs'; } /** * @return array validation rules for model attributes. */ public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('student_docs_path, doc_category_id, title,student_docs_submit_date', 'required','message'=>""), array('student_docs_desc', 'length', 'max'=>50), array('student_docs_path', 'file', 'types'=>'jpeg, jpg, pdf, txt, doc,docx, gif, png', 'maxSize'=>1024*1024*2, 'tooLarge'=>'The document was larger than 2MB. Please upload a smaller document.',), //array('title','CRegularExpressionValidator','pattern'=>'/^[a-zA-Z& ]+([-]*[a-zA-Z0-9 ]+)*$/','message'=>''), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('student_docs_id, student_docs_desc, student_docs_path, doc_category_id,student_docs_submit_date, title', 'safe', 'on'=>'search'), ); } /** * @return array relational rules. */ public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( ); } /** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'student_docs_id' => 'Student Docs', 'student_docs_desc' => 'Document Description', 'student_docs_path' => 'Document', 'doc_category_id' => 'Document Category', 'title' => 'Title', 'student_docs_submit_date'=>'Submit Date', ); } /** * Retrieves a list of models based on the current search/filter conditions. * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions. */ public function search() { // Warning: Please modify the following code to remove attributes that // should not be searched. $criteria=new CDbCriteria; $criteria->compare('student_docs_id',$this->student_docs_id); $criteria->compare('doc_category_id',$this->doc_category_id,true); $criteria->compare('title',$this->title,true); $criteria->compare('student_docs_desc',$this->student_docs_desc,true); $criteria->compare('student_docs_path',$this->student_docs_path,true); return new CActiveDataProvider($this, array( 'criteria'=>$criteria, )); } }Hello everyone! Please help save me because I am about to loose my mind. First- I have a database for a company I have been working on and for this database one of the things they would like is to have a tab to add documents to a specific clients database profile. I have done all of that and added the tab to add documents however, it will not allow me to add the document. I have attached a picture to show you what the error is. Basically everything else is working fine- I give the file a name, description, date of upload, and all of that gives me the green arrow beside it saying its fine however, when I add the file (any file extension) it will give me a red "x" beside the file path saying it can't be added. (see picture adddocument.png to see the display). Here is also the code that is controlling the document upload page- maybe I am missing something. Maybe you will be able to catch it before I will- I have been staring at this for days now trying to get it to work! Thanks for the help in advance! Attached Files Add Document.png 15.22KB 0 downloads Hi Friends, I am trying to do an API with oracle database. The JSON request from 3rd party will look like below. { "contact_id": "1", "serial_no": "100", "name": "baby", "inv_date": "2018-06-27", "due_date": "2018-06-27", "currency": "KD", "subtotal": "143", "tax_total": "13", "shipment_data": [ { "serial_no": "33", "master_no": "55", "house_no": "77", "cost_revenue_items": [ { "charge_ref": "rr", "currency": "INR", "quantity": "2", "selling_rate": "45", "exchange_rate": "7", "taxes": [ { "serial_no": "1", "ref": "INR", "voiding_remarks": "oo" },{ "serial_no": "2", "ref": "KWD", "voiding_remarks": "asd" } ] } ] } ] }
how to handle request for JSON in which master is updated (PUT) and child record is (Either INSERTED, UPDATED or DELETED) ? Hi, I need a preg_match for the following criteria: - no leading or trailing white space allowed - only alphanumeric characters and spaces are allowed (no full stops, commas apostrophe's, explanation marks, quotes, etc) - only one space allowed between each word (if there is more than one word) Thanks. Okay, so below I have posted my code, the problem I am having is not knowing how PDO works that well. So what I have attempted to do here is use SQL to check if the user and password are correct, but I'm not sure how to carry on. I realize I have to determine if the database found the matching password and/or username but I have no idea how, any help will be much appreciated. <html> <head> <title>Database login</title> <?php if (isset($_POST['submit'])) { print_r($_POST); $password = md5($_POST['password']); echo'<p>'.$password.'</p>'; $username = ($_POST['username']); echo'<p>'.$username.'</p>'; } ?> </head> <body> <?php $db = new PDO('sqlite:login.sqlite'); $login = 'SELECT * FROM login WHERE userid="'.$username.'" AND password="'.$password.'";'; echo'<p>'.$login.'</p>'; $attempt = $db->query($login); ?> <form method="post" action="Db_login.php"> <p>Username:<br /><input type="text" name="username" /> </p> <p>Password:<br /><input type="password" name="password" /></p> <p><input type="submit" name="submit" value="Log In!" /></p> </body> </html> How can I make it so that if file_get_contents cannot find the file else <?php $file = file_get_contents("http://www.example.com/lol.txt"); if ( $file == true ) { } else { } I am trying to update task based progress updates. I've got a very simple database that needs to be updated with:
Database name: progress
1. ID (auto increment)
2. admin (name of the project manager)
3. adminid (ID of the project manager in the project manager db)
4. member (name of the member of the project in the members db)
4. project (particular project being updated)
5. status (progress of the project as a number between 10 and 90)
6. timestamp
I have the following php script update insert a new line into my progress table:
if (!empty($_POST['progress'])) { if(Input::exists()) { if(Token::check(Input::get('token'))) { $adminprogress = Input::get('admin'); $adminidprogress = Input::get('adminid'); $memberprogress = Input::get('member'); $projectprogress = Input::get('project'); $statusprogress = Input::get('status'); $timestamp = date('Y-m-d H:i:s'); $progressupdate = DB::getInstance()->insert(progress, array( 'admin' => $adminprogress, 'adminid' => $adminidprogress, 'member' => $memberprogress, 'project' => $projectprogress, 'status' => $statusprogress, 'timestamp' => $timestamp )); Redirect::to('memberattire1.php'); } } }And I have the following code in the body of my page: <form method="post" action=""> <label> <select name="status"> <option value=choose>---Please Select---</option> <option value = "0">(10%) Bunker Registered</option> <option value = "10">(20%) First discussions held</option> <option value = "20">(30%) Initial research undertaken</option> <option value = "30">(40%) Ideas shared</option> <option value = "40">(50%) Enquiries made</option> <option value = "50">(60%) Results of enquiries shared</option> <option value = "60">(70%) Preferences shared</option> <option value = "70">(80%) Decisions made</option> <option value = "80">(90%) Decisions being executed</option> <option value = "90">(100%) Project Completed</option> </select> </label> <br><br> <input type="hidden" name="member" value="<?php echo $membername; ?>"> <input type="hidden" name="admin" value="<?php echo $admin; ?>"> <input type="hidden" name="adminid" value="<?php echo $adminid; ?>"> <input type="hidden" name="project" value="attire1"> <input type="hidden" name="token" value="<?php if(isset($token)) { echo $token; } else { echo $token = Token::generate(); } ?>" > <input type="submit" value="Submit Update" name="progress"> </form>I know my $membername, $admin and $adminid are ok because I can simply echo them out to confirm them, so there is something silly in my coding that I've overlooked. Can someone with a fresh pair of eyes see a typo or missed semi-colon or whatnot? Many thanks for any help. One of my virtual hosts contained php_value upload_max_filesize 8M which resulted in error when running as php-fpm. Also, looks like .htaccess files are no longer used. Any other gotcha's??? Reading up on it, looks like I want to move all .htaccess instructions to a https://www.php.net/manual/en/configuration.file.per-user.php file. Should be straight forward enough. Looking at https://www.php.net/manual/en/configuration.changes.php, looks like I should scan /etc/httpd/* as well as any virtual sites defined elsewhere for "php_" and move these requirements elsewhere. Will this also have to be a per directory .user.ini file? Reason I ask is I always thought it was better performance to when possible use apache's conf file than a .htaccess file. I have a html/php i am creating but getting the following error:
[10-May-2019 09:42:13 UTC] PHP Fatal error: Uncaught Error: Call to a member function prepare() on null in C:\inetpub\wwwroot\SupportDesk\php\Add_New_Engineer.php:88
<?php $server = htmlentities($_SERVER['PHP_SELF']); if (isset($_POST['submit'])) { $result = create_eng(); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Add A New Engineer | DDS Dashboard</title> <meta charset="utf-8" /> <link rel="icon" type="image/png" href="../images/favicon-16x16.png"/> </head> <body> <?php include('nav.php'); include('ConnectionDB.php'); ?> <div class="jumbotron"> <div class="container"> <h1><br><img src="../images/clipboard-customer.png"/> Add New Engineer:</br></h1> </div> </div> <form class="form-horizontal" role="form" id="add_eng" action="<?php $server ?>" method = "post"> <div class="form-group"> <!--<?php //display_msg($msg);?>--> <label for="EngineerName" class="col-sm-2 control-label">Engineer Name:</label> <div class="col-sm-6"> <input type="text" class="form-control" id="EngName" name="EngineersName" placeholder="Enter Engineer's Name"></input> <small class="form-text text-muted"> Enter the new engineer's name above to enter them into the database. </small> </div> <input name="submit" type="submit" value="Create Engineer" class="btn btn-primary default"></input> <input name="reset" type="Reset" value="Reset Form" class="btn btn-primary default"></input> </div> </form> <br><br> </body> </html> <?php $sql = "Select * from [Engineers] where [Engineer] not like '%\_%' Escape '\' order by [Engineer] asc"; $stmt = $conn->prepare($sql); $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); ?> <div class="containerenglist"> <div class="col-sm-5"> <table id="alleng" class="table table-bordered"> <tr> <th>Active Engineer's Names:</th> </tr> <?php foreach ($results as $row) { echo "<tr><td>"; echo $row['Engineer']; echo "</td>"; echo "</tr>"; } ?> </table> </div> </div> </body> </html> <?php Function create_eng(){ global $msgID; global $msg, $conn; include('ConnectionDB.php'); $conn = null; $msgID = 0; //Get POST from submit $eng_name = $_POST['EngineersName']; //SQL Query $sql_count = "select count(*) as num from [Engineers] where [Engineer] = :eng_name"; //Query SQL Statement //echo $eng_name; $stmt = $conn->prepare($sql_count); $stmt->bindValue(':eng_name', $eng_name); //Execute SQL Statement $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); If($results['num'] > 0){ echo $msg = "Engineer $eng_name exist's in the database"; $msgID = 1; }else{ $sql_insert = "insert into [Engineers](Engineer) values '$eng_name'"; //Prepare SQL Statement $stmt = $conn->Prepare($sql_insert); //Execute SQL Statement $stmt->execute(); $results=$stmt->fetchAll(PDO::FETCH_ASSOC); echo $msg = "Engineer $eng_name added to the database"; $msgID = 2; } } ?> Everything works correctly until i try submitting a name to the DB the line that is being pulled is $stmt = $conn->prepare($sql_count);
I have a login page that after logging in it sets a session Code: [Select] $_SESSION['user_info'] = $_POST['username']; and takes me to a start page (and checks for the session) which all works wonderfully. The problem is that no matter what link is clicked on that page it takes me to the login page again after checking to see if that same session is set Code: [Select] session_start(); if(!isset($_SESSION['user_info'])){ header("Location: http://website.com/folder/log_in.php"); } After logging in a second time every link on that same start page works wonderfully. If it works the second time why not the first? Hi,
I am fairly new to PHP, I am tryin to put a code together that would see my incoming CLI as 44 and remove the 44 from it and add a 0 to it. I have managed to do this so far, now I am stuck, as any number thats not matching the length (10 digits ) or is not starting with 44 is also not forwarded to my database for query.
$input = ($cid); if(preg_match('/^(44|0)(\d{10})$/',$input,$matches)){ $phone = '0'.$matches[2]; }else die("Invalid Phone Number") ; What I would like is that any number starting with 441234567890 to become 01234567890, but should not involve 10 digits criteria. Any help would be appreciated. Trying to make the email field in my form mandatory. Im new to php, more used to javascript but from everything i have read php is more universal. Here is my code, any help would be great. Code: [Select] <?php $emailsubject = 'Golf Registration'; $webMaster = 'dustin@duncantek.com'; $namea = $_POST['namea']; $nameb = $_POST['nameb']; $namec = $_POST['namec']; $named = $_POST['named']; $total = $_POST['total']; $sponsor = $_POST['sponsor']; $email = $_POST['email']; $comments = $_POST['comments']; $body = <<<EOD <br><hr><br> Golfer1: = $namea <br> Golfer2: = $nameb <br> Golfer3: = $namec <br> Golfer4: = $named <br> Total Owed: = $total <br> Sponsorship Name: = $sponsor <br> Comments: = $comments<br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailsubject, $body, $headers); $theResults = <<<EOD <!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=iso-8859-1" /> <title>Thanks For Registering</title> <link href="golf-website.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="border"> <div class="name">Thanks For Registering!</div> <div id="links_bg"> <div class="toplinks"><a href="default.html">Homepage</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">About Us</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Donations</a></div> <div class="toplinks"><a href="tourneyinfo.html">Events</a></div> <div class="toplinks"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Contact us</a></div> </div> <div class="gap"></div> </div> </div> <div id="heading-bg"> <div align="left">Registration Complete</div> </div> <div id="main"> <p>Thank you for taking the time to register, we will email you back shortly to confirm registration along with an invoice via paypal. This is strictly for your convenience, we will also accept payment at the course on the day of the tournament. Thanks Again!</p> </div> <div id="bottom"> <div class="bottomlink"><a href="default.html">Home</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="aboutus.html">About Us</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Donations</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="tourneyinfo.html">Events</a></div> <div class="sap">|</div> <div class="bottomlink"><a href="file:///C|/Users/Dustin/Desktop/Templates/Golf-Website/index.html">Contact Us</a></div> </div> <center><div class="quicklinks"></div> </div> </body> </html> EOD; echo "$theResults"; ?> <!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=iso-8859-1" /> <title>Tournament Info</title> <link href="golf-website.css" rel="stylesheet" type="text/css" /> </head> <body> <td width="104"><label for="namea"> <div align="right">Golfer #1:</div> </label> </td> <td width="387"><div align="left"> <input name="namea" type="text" id="namea" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="name2"> <div align="right">Golfer #2:</div> </label> </td> <td><div align="left"> <input name="nameb" type="text" id="nameb" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="namec"> <div align="right">Golfer #3:</div> </label> </td> <td><div align="left"> <input name="namec" type="text" id="namec" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="named"> <div align="right">Golfer #4:</div> </label> </td> <td><div align="left"> <input name="named" type="text" id="named" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left">The option to sponsor a hole is also available, the price per hole is $200.00, please enter in the box below what you would like the sponsorship to be if any.</div></td> </tr> <tr> <td><div align="right"> <label for="total">Total:</label> </div></td> <td><div align="left"> <input name="total" type="text" id="total" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"> <label for="sponsor">Sponsorship:</label> </div></td> <td><div align="left"> <input name="sponsor" type="text" id="sponsor" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><div align="right"> <label for="email">Email: </label> </div></td> <td><div align="left"> <input name="email" type="text" id="email" size="35" maxlength="80" /> </div></td> </tr> <tr> <td><label for="comments">Additional Comments:</label></td> <td><textarea name="comments" cols="35" rows="6" id="comments"></textarea></td> </tr> </table> <p> </p> <blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <p> <input type="submit" name="send" id="send" value="Submit" /> <input type="reset" name="reset" id="reset" value="Reset" /> </p> </blockquote> < </body> </html> MOD EDIT: code tags added. 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 i need help in this form Code: [Select] <FORM action="thanx.php" method="post"> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center><FONT color=#ff0000>* </FONT>title:<BR><INPUT size=40 name=title><BR></TD> </TR> </TBODY> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center><FONT color=#ff0000>* </FONT>Url<BR><INPUT size=40 name=url value=http://><BR><TD></TR></TBODY></TABLE> </TD> </TR> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center>description<BR> <textarea cols="50" rows="4" name="description"></textarea><BR><TD></TR></TBODY></TABLE> </TD> </TBODY></TABLE> <P style="TEXT-ALIGN: center" align=center><INPUT class=submit type=submit value="add" name=send></TD> </FORM> first : i want make fields required "at lest Three letters" using php not java ... but i want the user don't leave the form if this fields empty .. and i need the user don't go the add.php if this fields empty like :: please fill the blank fields second : some time my users post in the in fields ..something like this Code: [Select] <SCRIPT type=text/javascript> <!-- //--> </SCRIPT> or something like this Code: [Select] <a href=""</a> and some time user write one letter in the field i don't accept this ..because it makes problems in the results.. so what can i do to fix this and make security for this . so can anyone help me ..please Hi all, I wonder if anyone could give me some idea: I have a form and one of the filed is an email (must field) if empty an error message will show up: - Now I want to add a CHECKBOX where when the CHECKBPX is clicked the "must field" email will become" not must field one" (Not required field). I have this code as my snippets: Code: [Select] <form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="noemail"> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> .. </form> .. .. $error = 0; $errormsg = ""; .. .. if ($_POST['action'] == "register") { if (($_POST['email1'] == "") OR (!check_text($_POST['email1']))) { $error = 1; $errormsg .= "Please enter your requested email address<br>"; $errornum[3] = 1; } } .. Can anyone assist me what shall I add so I can achieve this please? Thanks in advance. Siabanie Hi, I'm integrated paypal standard integration on my website. It integrated successfully.. we collect the data on website and send all info to paypal. in database order table. I set the status to 0 which means order is pending. Now i'm confused how it'll be 1? when i'll come to know that client has paid the payment. do i need to set it flag manual in admin panel after check into my paypal account? or do i need to send some parameter on return valraible. if he i'll return to that page then query to set flag 1. Please help me on this. and let me know which one is best method??? Looking forward. Best regards Or is the ORM the only mapper? This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=313541.0 |