PHP - How To Back Up A Database
Hello everyone! I am a new user and I have a simple question. How to download the database and create a backup. Similar TutorialsI have a profile page where the user answers a list of about 20 questions. These questions are then put into a mysql table with username, questionid, and answer. I can store the answers to the table, but I cannot figure out how to get them back to view and edit. My form is built from basic HTML. I know how to pull answers from a db table with only 1 row of results, where each field is a different question, but this one is different, as it will pull 20 rows, and each row is for a different question. Here is how I populate the questions and then fill in the answers. Code: [Select] // If this user has never set their profile, insert empty questions into the database $query1 = "SELECT * FROM u_profile WHERE username = '" . $_SESSION['username'] . "'"; $data = mysqli_query($dbc, $query1); if (mysqli_num_rows($data) == 0) { // First grab the list of questionids $query2 = "SELECT questionid FROM questions ORDER BY q_order"; $data = mysqli_query($dbc, $query2); $questionids = array(); while ($row = mysqli_fetch_array($data)) { array_push($questionids, $row['questionid']); } // Insert empty question rows into the u_profile table, one per question foreach ($questionids as $questionid) { $query3 = "INSERT INTO u_profile (username, questionid) VALUES ('" . $_SESSION['username']. "', '$questionid')"; mysqli_query($dbc, $query3); } } // If the questionnaire form has been submitted, write the responses to the database if (isset($_POST['submit'])) { // Write the questionnaire response rows to the response table foreach ($_POST as $answer_id => $answer) { $query4 = "UPDATE u_profile SET answer = '$answer' WHERE username = '" . $_SESSION['username'] . "' AND questionid = '$answer_id'"; $uprofile_set = "CALL uprofile_set('" . $_SESSION['username'] . "')"; mysqli_query($dbc, $query4) or die( "Connection Error1" . mysqli_error($dbc) ) ; mysqli_query($dbc, $uprofile_set) or die( "Connection Error2" . mysqli_error($dbc) ) ; } $races = "SELECT * FROM u_raceschedule WHERE username = '" . $_SESSION['username'] . "'"; $data = mysqli_query($dbc, $races); if (mysqli_num_rows($data) > 0) { set_time_limit(30); $buildplan = "CALL tplan('" . $_SESSION['username'] . "')"; mysqli_query($dbc,$buildplan) or die("Connection Error2" . mysqli_error($dbc) ) ; Would LOVE any help. I am really new to this whole coding thing. Ok so I have this site where I'm posting a message to my Database. But when I go to pull the message from the MYSQL DB it's one long sentence. Any suggestions? Hi.. I've seen code for back up database but when I run the code the database was backup outside the folder. I want to put the back up database inside the folder here is the code: Code: [Select] <?php include 'config.php'; backup_tables('localhost','root','','payroll'); /* backup the db OR just a table */ function backup_tables($host,$user,$pass,$name,$tables = '*') { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the tables if($tables == '*') { $tables = array(); $result = mysql_query('SHOW TABLES'); while($row = mysql_fetch_row($result)) { $tables[] = $row[0]; } } else { $tables = is_array($tables) ? $tables : explode(',',$tables); } //cycle through foreach($tables as $table) { $result = mysql_query('SELECT * FROM '.$table); $num_fields = mysql_num_fields($result); $return.= 'DROP TABLE '.$table.';'; $row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table)); $return.= "\n\n".$row2[1].";\n\n"; for ($i = 0; $i < $num_fields; $i++) { while($row = mysql_fetch_row($result)) { $return.= 'INSERT INTO '.$table.' VALUES('; for($j=0; $j<$num_fields; $j++) { $row[$j] = addslashes($row[$j]); $row[$j] = ereg_replace("\n","\\n",$row[$j]); if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; } if ($j<($num_fields-1)) { $return.= ','; } } $return.= ");\n"; } } $return.="\n\n\n"; } //save file $myfoldername = "backup_DBPayroll";//your folders name $handle = fopen(getcwd().$myfoldername.'db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+'); // $handle = fopen('db-backup-'.date('m-d-Y').'-'.(md5(implode(',',$tables))).'.sql','w+'); fwrite($handle,$return); fclose($handle); } $smarty->display('header_cat.tpl'); $smarty->display('backup.tpl'); $smarty->display('footer.tpl'); ?> Thank you in advance Hi All, I have a table (with an ID of example) that can be seen he http://tinyurl.com/cfla7wp The following script calls jeditable.js and makes the Telephone & Mobile columns editable. Once edited, the table shows the new value plus a * symbol. Code: [Select] <script type="text/javascript"> $(document).ready(function() { /* Init DataTables */ var oTable = $('#example').dataTable(); /* Apply the jEditable handlers to the table */ $('td:eq(4), td:eq(5)', oTable.fnGetNodes()).editable( 'update_table_tenants.php', { "callback": function( sValue, y ) { var aPos = oTable.fnGetPosition( this ); oTable.fnUpdate( sValue, aPos[0], aPos[1] ); }, "submitdata": function ( value, settings ) { return { "row_id": this.parentNode.getAttribute("1"), "column": oTable.fnGetPosition( this )[2] }; }, "height": "14px" } ); } ); </script> What I need to do however is add the value entered into my database, but I do not know how to do this. I believe I need to do something like: UPDATE my_table VALUE whatever column has been edited in the table WHERE tenID is the same as the row selected in the table i.e. if I update the MOBILE NUMBER of the person called BILL GATES it would find his tenID, update numMobile in the table called my_table All help appreciated Dave I have a table that has a cell that I've made editable:
echo "<td contenteditable='true'>" . $row['Comments'] . "</td>";Which is cool I guess, but it doesn't go anywhere from there. I'd like to make it so that upon changing, it links back to an SQL UPDATE query that I define. Is this possible through some sort of onChange function? "BACK" or REFRESH: Preventing database interaction / code execution how to prevent database interaction / code execution when user presses back or refresh button? can i detect? can i disable back/refresh? Please, take a look to the following code.After clicking Next it goes to overview.php.Why when I click back on my browser to return to this page again, it is not returning back? When I click back I receive "Confirm Form Resubmission" message. After refreshing page it loads page. I guess problem is in "session_start();" part. Something to do with cookies. Please, help me it is very urgent for me. <?php session_start(); echo "<html> <head> <title>Hello World</title> <meta http-equiv='Content-Type' content='text/html; charset=Windows-1252'/> </head>"; require_once ('functions.inc'); if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'index.php'"; echo "</script>"; exit; }else{ session_register("userid", "userpassword"); $username = auth_user($_POST['userid'], $_POST['userpassword']); if(!$username) { $PHP_SELF = $_SERVER['PHP_SELF']; session_unregister("userid"); session_unregister("userpassword"); echo "Authentication failed " . "Please, write correct username or password. " . "try again "; echo "<A HREF=\"index.php\">Login</A><BR>"; exit; } } function auth_user($userid, $userpassword){ global $default_dbname, $user_tablename; $user_tablename = 'user'; $link_id = db_connect($default_dbname); mysql_select_db("d12826", $link_id); $query = "SELECT username FROM $user_tablename WHERE username = '$userid' AND password = '$userpassword'"; $result = mysql_query($query) or die(mysql_error()); if(!mysql_num_rows($result)){ return 0; }else{ $query_data = mysql_fetch_row($result); return $query_data[0]; } } echo "hello"; echo "<form method='POST' name='myform' action='overview.php'>"; echo "<input type='submit' value='Next'>"; echo "</form>"; ?> Say I have the following text stored in a MySQL database... Code: [Select] <b>Classic Quote from movie</b> and I retrieve it into a variable called $text, how do I properly echo that so that it keeps the bold tags and actually display the text "Classic quote from movie" in BOLD? I'm doing something wrong somewhere along the line (simply doing "echo $text;") because it displays on the page as... Code: [Select] <b>Classic Quote from movie</b> Instead of... Classic Quote from movie Any info on properly storing and echoing back HTML would be very appreciated. Hey everyone. So lately I've been searching for someone to do this for me but I figure if I learned it myself it'd be much more helpful to me in the future. I run a gaming clan, and we have a roster. You can view it he http://www.zealotgam...s.php?pageid=15 Obviously, you can see a few things. The default page lists all our staff. That is very easy, and not really the part I need help with. The help begins with the games list you see at the side. When you click a game, it lists all users who have that Game listed as their Main Game in a profile field, and lists other info, such as their rank, In-Game contact (which is another profile field) and join date/last active. The games are also themselves divided into categories. Our code is relatively simple. We keep a manual array of info that keeps these together you can see below: // Define Games and Lists // $gameslist = array(); //SETUP $gamelist[] = array("Game Name","urlshortcode","Name of In-Game Name or Account", "field# for that profile field"); $gameslist[] = array("Battlefield 4 (PS4)", "bf4ps4", "PlayStation ID", "field7"); $gameslist[] = array("Counter Strike: Global Offensive (EU)", "csgoeu", "Steam ID", "field8"); $gameslist[] = array("Counter Strike: Global Offensive (NA)", "csgona", "Steam ID", "field8"); $gameslist[] = array("Elder Scrolls Online (NA)", "esona", "Main Character", "field45"); $gameslist[] = array("League of Legends (EUNE)", "loleune", "Summoner Name", "field12"); $gameslist[] = array("League of Legends (EUW)", "loleuw", "Summoner Name", "field31"); $gameslist[] = array("League of Legends (NA)", "lolna", "Summoner Name", "field32"); $gameslist[] = array("League of Legends (OCE)", "loloce", "Summoner Name", "field47"); $gameslist[] = array("Minecraft", "mc", "Username", "field14"); $gameslist[] = array("Smite (EU)", "smiteeu", "Smite Account", "field22"); $gameslist[] = array("Smite (NA)", "smitena", "Smite Account", "field22"); $gameslist[] = array("Titanfall", "tfall", "Origin ID", "field29"); $gameslist[] = array("WildStar (EU)", "wseu", "Main Character", "field48"); $gameslist[] = array("WildStar (NA)", "wsna", "Main Character", "field48"); $gameslist[] = array("World of Tanks (EU)", "woteu", "WarGaming.NET ID", "field46"); $gameslist[] = array("Other Game", "other", "", ""); // Game Type Categories $gamecats = array(); // ADD the # of the game in the list above (starting from 0) to the appropriate category array number list. $gamecats[] = array("Divisions",array(4,5,6)); $gamecats[] = array("Guilds",array()); $gamecats[] = array("Gaming Groups",array()); $gamecats[] = array("Divisions in Development",array(0,1,2,3,7,8,9,10,11,12,13,14)); $gamecats[] = array("Miscellaneous",array(15)); This gets tedious to keep track of manually, and my admins with no programming experience can barely understand what is happening. The listing of users is very easy, and I do not need any help with that. What I would like to add is a manager in the admin panel where you could save the information listed above to a table such as PREFIX.games. I imagine having several drop down boxes. A mockup is below: I'd then Like a list of games that includes these rows in the table with a [ ] Remove checkbox. I do not know how to add this to the admin panel and would love guidance on how to begin doing this. The sorting would go by Game Status (the second array in my php code) then Alphabetical. This would go a long way in helping my staff edit this list themselves. Any help would be appreciated. Skype: j.c.will my be better to work personally with me. And we're back online... again! It may have taken 3-4 days, but we're back.
I have the following code. Before back button was working. Now don't understand what happend but when I click Back button I receive "Webpage has expired" window in my browser. What may be the reason? Code: [Select] <html> <head> <title>Økern Frukt og Grønt</title> <link href="calendar/calendar.css" rel="stylesheet" type="text/css" /> <script language="javascript" src="calendar/calendar.js"></script> <style type="text/css"> textarea { resize: none; } </style> <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"/> </head> <?php if(!isset($_POST['userid'])) { echo "<script type='text/javascript'>"; echo "window.location = 'login.html'"; echo "</script>"; exit; } require_once ('functions.inc'); require_once('calendar/classes/tc_calendar.php'); global $default_dbname; $link_id = db_connect($default_dbname); mysql_select_db("okern", $link_id); $letters1 = array ("A1", "B1", "C", "D","E", "F", "G", "H","I", "J", "K", "L", "M", "N", "O", "P","Q", "R", "S", "T","U", "V", "W", "X", "Y", "Z", "&#198", "&#216", "&#197"); $letters = array_merge(range("A", "Z"), array("&#38;#198", "&#38;#216", "&#38;#197")); echo "<table border='0' align='center'> <tr> <td colspan=3><b><center>Du har valgt f&#248lgende produkter</center></b></td> </tr> <tr> <th align=left>Produkt</th> <th align=left>Antall</th> <th align=left>Enhet</th> </tr>"; echo "<form method='POST' action='order.php'>"; $userid = $_POST['userid']; echo "<INPUT TYPE='hidden' NAME='userid' VALUE='$userid'>"; foreach($letters as $letter) { if(isset($_POST[$letter])) { $selected = $letter . '1'; $antall = $letter . '2'; $enhet = $letter . '3'; echo "<tr>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$selected' VALUE='$_POST[$selected]'>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$antall' VALUE='$_POST[$antall]'>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "<INPUT TYPE='hidden' NAME='$enhet' VALUE='$_POST[$enhet]'>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } for ($i = 1; $i < 400; $i++) { if (isset($_POST[$i])){ $selected = 'a' . $i; $antall = 'antall' . strval($i); $enhet = 'enhet' . strval($i); echo "<tr>"; echo "<td>" . "$_POST[$selected]" . "</td>"; echo "<td>" . "$_POST[$antall]" . "</td>"; echo "<td>" . "$_POST[$enhet]" . "</td>"; echo "</tr>"; } } echo "<tr height=10></tr> <tr><td colspan=2>Velg dato for bestillingen:</td> <td colspan=1>"; $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->writeScript(); echo "<INPUT TYPE='hidden' NAME='date' VALUE='this.form.date5.value'>"; echo "</td></tr>"; echo "<tr height=10></tr><tr> <td colspan=3>Skrive din melding nedenfor:</td> </tr>"; echo "<tr> <td colspan=3><textarea name='melding' cols='50' rows='5' resize=none></textarea></td> </tr>"; echo "<tr> [b]<td><center><input type='button' value='Tilbake' onClick='history.go(-1)'></center></td>[/b] <td colspan=2><center><input type='submit' value='Bestil'></center></td> </tr>"; echo "</form>"; echo "</table>"; ?> </html> I made a file for updating data. I do get the id back from the view page, but not the variable. What do I do wrong? I'm puzzling a few days, but just don't see it. This my code: Code: [Select] <?php // init $msg = ''; $errorMsg = ''; $rep_id = array(); $componist = ''; $repertoire = ''; $titel = ''; $formOK= false; // + + + + + + + + GET + + + + + + + + if(isset($_GET['id'])) { $rep_id = inputControl($_GET['id']); } if(isset($_GET['componist'])) { $componist = inputControl($_GET['componist']); } //print "session: $login_id, $login_recht"; // TEST van de sessie // + + + + + + + + + + + + + + + + POST + + + + + + + + + + if (isset($_POST['UpdateRepSubmit'])) { if (isset($_POST['componist'])) { $componist = inputControl($_POST['componist']); } if (isset($_POST['titel'])) { $titel = inputControl($_POST['titel']); } } //print'<pre>'; print_r($repertoire); print '</pre>'; //TEST2 // + + + + + + + + + + + + + + + + + + + queries $select_query= "SELECT * FROM repertoire_eng ORDER BY componist ASC "; print $select_query; // TEST 3 // # # # # # # # # # # # database connectie # # # # # # # # # # $dblink = mysqli_connect($host,$user,$pass,$db) or die ('Mysql-connectie heeft gefaald.'); if (!$dblink) { // + + + + + + fout bij met maken van databaseverbinding $errorMsg = "Geen verbinding met de MySQL-server"; } else { $result = mysqli_query($dblink, $select_query); if($result) { $i = 0; while ($row = mysqli_fetch_array($result)) { // uitlezen resultaat $repertoire_ids[$i] = $row['id']; $componisten[$i] = $row['componist']; $titels[$i] = $row['titel']; $i++; } } else { // + + + + + fout bij het uitvoeren van de query $errorMsg = "De query kon niet worden uitgevoerd."; } // # # # # # # # # # # einde database connectie # # # # # # # # # mysqli_close($dblink); } ?> In the html block: Code: [Select] <div id="container"> <form action="edit_repertoire.php" method="post" name="edit_repertoire" onsubmit = "return checkForm(this)"> <fieldset> <legend>Update repertoire in your list:</legend> <!-- # # # # # # Toevoegen van een hiddenfield om de id op te halen uit de URL # # # # # # --> <input type="hidden" name="id" value = "<?php echo $rep_id; ?>" > <p>ID= <?php echo $rep_id; ?></p> <p> Componist = <?php echo $componisten; ?></p> <!-- + + + + + + + FORMREGELComponist + + + + + + + --> <div class="formregel"> <div class="formkolomlinks">Composer name:</div> <div class="formkolomrechts"><input name="componist" id="componist" type="text" maxlength="128" value="<?php echo $componist; ?>" /> Name first, then the initials! </div> </div><!-- Einde formregel --> <!-- ++ + + + + + FORMREGEL Compositie en of rol + + + + + + + --> <div class="formregel"> <div class="formkolomlinks">Composition and or role</div> <div class="formkolomrechts"><input name="titel" id="titel" type="text" maxlength="128" value="<?php echo $titel; ?>" /></div> </div><!-- Einde formregel --> <!-- +++++++ FORMREGEL +++++++ --> <div class="formregel"> <div class="formkolomlinks"><input name="updateRepSubmit" type="submit" value="Update repertoire" /></div> </div><!-- Einde formregel --> </fieldset> </form> <div class="clear"></div> </div><!-- einde container --> </div><!-- einde tot_wrap --> edit: added [code][/code] blocks Hi All I am wanting to start writing neater coding so am wanting to refer to coding in a functions file. So for example, If i was getting info from database using the following code Code: [Select] $queryone = "SELECT * from affiliate where size='300x250' ORDER BY RAND() LIMIT 1"; $result = mysql_query($queryone); while ($row = mysql_fetch_assoc($result)) { echo "".$row['code'].""; } I would want this to go in a file called functions.php Then in my index.php(for example) I would want to link up to this code. Can anyone point me in the right direction please? Thanks! I have tried to create a back button, but I have not reached the correct solution. I log into first page (index.php) and then you will get two new buttons that brings me to two different pages. Then I want to come back to the login page, the session is gone and I have to log in again. I want to remain logged in when I get to the index page and be able to see the two buttons. I tried different things such as: Code: [Select] <input type="button" value="Return to previous page" onClick="javascript:history.go(-1)" /> Code: [Select] <?php $referer = $_SERVER['HTTP_REFERER']; if (!$referer == '') { echo '<p><a href="' . $referer . '" title="Return to the previous page">« Go back</a></p>'; } else { echo '<p><a href="javascript:history.go(-1)" title="Return to the previous page">« Go back</a></p>'; } ?> But that's not what I'm thinking about. How can I solve this? index.php <?php session_start(); if(isset($_POST['LoutBtn'])) { session_destroy(); } if(isset($_POST['LoginBtn'])) { //convert a string to all lower case letters. //if user gives username with big letters still can login. $user = strtolower($_POST['username']); $pass = $_POST['password']; if($user == 'admin' && $pass == '123') { $_SESSION['LogedIn'] = true; { print('Welcome admin'); ?> <table width="50" align="right" cellpadding="2" cellspacing="2"> <form method="POST" action="panel.php"> <tr> <td><input type="submit" value="add post" name="PnlBtn" /></td> </tr> </form> <form method="POST" action="stat.php"> <tr> <td><input type="submit" name="showstat" value="visitorlog" /></td> </tr> </form> </table> <?php } } elseif (empty($user) || empty($pass)) { print('<font color="#FF0000">Please fill in username and password!<br/></font>'); } elseif ($_POST['username'] != 'admin'){ print('<font color="#FF0000">wrong username<br/></font>'); } elseif ($_POST['password'] != '123'){ print('<font color="#FF0000">wrong password<br/></font>'); //elseif { // print('<font color="#FF0000">The User Name And/Or Password is incorrect! // Please try again...<br/></font>'); //print('<a href="index.php">Back</a>'); } } ?> <?PHP /* define the blog content file name */ $filename = "myBlogContent.txt"; ?> <!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>Untitled Document</title> </head> <body> <form method="post" action="index.php" > <table width="300" border="1" align="right" cellpadding="2" cellspacing="2"> <tr> <td width="150">UserName:</td> <td> <input type="text" name="username" size="20" /> </td> </tr> <tr> <td width="150">Password</td> <td><input type="password" name="password" size="20" /></td> </tr> <tr> <td><input type="submit" value="Login" name="LoginBtn" /> </td> </tr> <tr> <td><input type="submit" value="Logout" name="LoutBtn" /></td> </tr> </table> </form> <!-- CONTENT DIV --> <div style="position:absolute; left: 100px; top: 100px; width: 400px;"> <?PHP /* check to see if the file exists */ if (!file_exists($filename)) { echo "The Blog Is Empty"; }else{ /* get the file lines into an array */ $BlogArray = file($filename); /* count the number of blog entries */ $count = count($BlogArray); $i=0; while($i<$count) { $new_array = explode("|", $BlogArray[$i]); echo "Posted by: " . $new_array[1] . "<br>"; echo "Posted on: " . date("m/d/y", time($new_array[0])) . "<br>"; echo "Title: " . $new_array[2] . "<br>"; echo $new_array[3] . "<hr>"; $i ++; } } ?> </div> </body> </html> panel.php <?php session_start(); if ($_SESSION['LogedIn'] == false) { $redirect = "Location: " . $_REQUEST['LoginBtn'] . "index.php"; echo header($redirect); } elseif ($_SESSION['LogedIn'] == true) { echo "welcome"; } //if(isset($_POST['LoutBtn'])){ //{ // session_destroy(); // header ('Location: index.php'); //if ($_SESSION['LogedIn'] == true) //{ // print('<h1>Welcome admin</h1>'); // } //else //{ // session_destroy(); // header ('Location: index.php'); //} ?> <!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>Untitled Document</title> </head> <body> <form action="content.php" method="post"> <table> <tr><td>Blog entry posted by (Your name): </td><td><input type="text" name="who" size="20" maxlength="20" value=""></td></tr> <tr><td>Title of this blog entry: </td><td><input type="text" name="title" size="40" maxlength="80" value=""></td></tr> <tr><td>Content: </td><td><textarea name="content" rows="5" cols="40"></textarea></td></tr> <tr><td clospan="2"><input type="submit" value="Submit"></td></tr> <tr><td clospan="2"><input type="submit" name="showstat" value="visitorlog" /></td></tr> <tr><td clospan="2"><input type="submit" value="Back" name="back" /></td></tr> </table> </form> </body> </html> hello PHP geniuses! I am new to this whole thing... so please be patient with me I have a form that is working great.... there are just a couple of things that I would like it to do that I can't figure out. PHP is still a mystery to me, but I am trying to learn. If I include the code, I am hoping someone can help. I would like to know if I can 1. cc the sender the form details 2. pull form data to create the subject line This is a HiQform, with attachments... My HTML: Code: [Select] <!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>Studio Job Ticket</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="calendar.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <h1><a>Studio Job Ticket</a></h1> <form id="studio job ticket" class="appnitro" enctype="multipart/form-data" method="post" action="HiQFM.php"> <div class="form_description"> <input type=hidden name="recipient" value="dayle_sheward@rogers.com,dayle.sheward@juniperpark.com"> <input type="hidden" name="redirect" value="http://dayle.me/form/thankyou.html"> <input type="hidden" name="form_format" value="html"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="hidden" name="path_to_file" value="http://dayle.me/form/TEMP_FILES"> <input type="hidden" name="subject" value="Studio Job Ticket"> <input type=hidden name="style_sheet" value="view.css"> <br /> <h2>Studio Job Ticket</h2> <p>The purpose of this form is to ensure the Juniper Park Studio receives all necessary files and information needed for dockets to be done in timely and accurate fashion. Please provide as <br /> much information as possible.</p> <p>Once this job ticket is received, you will be contacted by phone or email, confirming your job is <br /> in progress, with a rough estimate on when you can expect the first proof. </p> </div> <ul > <li class="description" id="li_1" > <label class="description" for="account manager">Account Manager</label> <span> <input id="first name" name= "first name" class="element text" maxlength="255" size="10" value=""/> <label>First</label> </span> <span> <input id="last name" name= "last name" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="email">Email</label> <div> <input id="email" name="email" class="element text" type="text" maxlength="255" value=""/> </div> </li> <li id="li_3" > <label class="description" for="job">Job</label> <span> <input id="client" name= "client" class="element text" maxlength="255" size="8" value=""/> <label>Client</label> </span> <span> <input id="brand" name= "brand" class="element text" maxlength="255" size="14" value=""/> <label>Brand</label> </span> </li> <li id="li_4" > <label class="description" for="media type">Media Type</label> <div> <select class="element select medium" id="media type" name="media type"> <option value=""selected="selected"></option> <option value="Award Work" >Awards Work</option> <option value="Collateral" >Collateral</option> <option value="OOH" >OOH</option> <option value="Print" >Print</option> <option value="Retouching" >Retouching</option> <option value="Photography" >Photography</option> </select> </div> </li> <li id="li_5" > <label class="description" for="docket">Docket (work cannot start without this)</label> <div> <input id="docket" name="docket" class="element text" type="text" maxlength="255" value=""/> </div> </li> <li id="li_6" > <label class="description" for="job">Creative Team</label> <span> <input id="AD" name= "AD" class="element text" maxlength="255" size="14" value=""/> <label>AD</label> </span> <span> <input id="Writer" name= "Writer" class="element text" maxlength="255" size="14" value=""/> <label>Writer</label> </span></li> <li id="li_7" > <label class="description" for="Supplied">Additional Information to Supply</label> <span> <input id="copy deck" name="copy deck" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_1">Copy Deck</label> <input id="spec sheet" name="spec sheet" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_2">Spec Sheet</label> <input id="ma" name="ma" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_3">MA</label> <input id="creative files" name="creative files" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="element_6_3">Creative Files</label> Please specify location files:</span></li> <li > <div> <input id="creative file location" name="creative file location" class="element text" type="text" maxlength="255" value=""/> or<br /> <input id="emailedYN" name="emailedYN" class="element checkbox" type="checkbox" value="1" /> <label class="choice" for="emailedYN">Check if to be Emailed</label> </div> </li> <li id="li_7" > <label class="description" for="upload">Upload a File </label> <div> <input id="attachment" name="attachment[]" class="element file" type="file"/> </div> </li> <li id="li_3" > <label class="description" for="due date">Due Date </label> <span> <input id="element_3_1" name="MM" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="element_3_1">MM</label> </span> <span> <input id="element_3_2" name="DD" class="element text" size="2" maxlength="2" value="" type="text"> / <label for="element_3_2">DD</label> </span> <span> <input id="element_3_3" name="YYYY" class="element text" size="4" maxlength="4" value="" type="text"> <label for="element_3_3">YYYY</label> </span> <span id="calendar_3"> <img id="cal_img_3" class="datepicker" src="calendar.gif" alt="Pick a date."> </span> <script type="text/javascript"> Calendar.setup({ inputField : "element_3_3", baseField : "element_3", displayArea : "calendar_3", button : "cal_img_3", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script> <li id="li_10" > <label class="description" for="element_10">Production Details</label> <div class="left"> <input id="trim" name="trim" class="element text" value="" type="text"> <label for="trim">Trim Size (width x height)</label> </div> <div class="right"> <input id="live" name="live" class="element text" value="" type="text"> <label for="live">Live (width x height)</label> </div> <div class="left"> <input id="bleed" name="bleed" class="element text" value="" type="text"> <label for="bleed">Bleed (width x height)</label> </div> <div class="right"> <input id="#mechanicals" name="#mechanicals" class="element text" value="" type="text"> <label for="#mechanicals"># of Mechanicals (if multiple, please provide a MA or spreadsheet)</label> </div> <div class="left"> <input id="die line" name="die line" class="element text" value="" type="text"> <label for="die line">Die Line</label> </div> <div class="right"> <input id="PU docket" name="PU docket" class="element text" value="" type="text"> <label for="PU docket">Pick-Up docket</label> </div> <div class="left"> <input id="FilesReq" name="FilesReq" class="element text" maxlength="15" value="" type="text"> <label for="FilesReq">To supply raw collected files or PDFX1a</label> </div> <div class="right"> <select class="element select medium" id="delivery" name="delivery" onClick='alert("Please provide all deliverable details, such as FTP/emails etc.; info in the ADDITIONAL INFO area below.")'> <option value="" selected="selected"></option> <option value="File Cargo" >File Cargo</option> <option value="FTP" >FTP</option> <option value="Email" >Email</option> <option value="Temp Folder" >Temp Folder</option> <option value="Disk" >Disk</option> </select> <label for="deliverable info">Deliverable Info</label> </div> </li> </li> <li id="li_13" > <label class="description" for="Additional">Additional Info</label> <div> <textarea id="Additional" name="Additional" class="element textarea medium"></textarea> </div> </li> </ul> <p> <label for="userCopyMe">Check the box if you wish to be sent a copy of this message</label> <br /> <input type="checkbox" name="userCopyMe" id="userCopyMe" value="1" <?php if ($userCopyMe == "1") { echo "checked=\"checked\""; }?> /> </p> <li class="buttons" id="saveForm"> <input type="reset" value="Reset" > <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" onclick="verify();"> </li> </ul> </form> <div id="footer"></div> </div> <img id="bottom" src="bottom.png" alt=""> </body> <name="form_delivery" value="digest"/> </form> </html> Thanks in advance! EDIT: pinche code tags. Hi everyone. I am looking at creating my application's back end with PHP, which returns all data with Jason or simplexml. I have tried Slim once, but think there should be something easier to use. Can anyone give me suggestions on what I can use which is easy to catch on, and maybe an example? Appreciate it. Kind regards Hello friends, I've php script that create files for example you enter file name (ex : test.php) file content (ex: any text ) it will create test.php file with the same content you entered. but the problem it add back slah \ before " or ' how can i stop it and make it not add back slash before " and ' here is the code <?php function saveFile($filename,$filecontent){ if (strlen($filename)>0){ $file = @fopen($filename,"w"); if ($file != false){ fwrite($file,$filecontent); fclose($file); return 1; } return -2; } return -1; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="domain" id="domain"> File name: <input name="filename" type="text" value="<?php echo $domainbase; ?>" /> File content: <textarea name="filecontent" rows="15" cols="46"></textarea> <input type="submit" name="submitBtn" value="Save file" /> </form> <?php if (isset($_POST['submitBtn'])){ $filename = (isset($_POST['filename'])) ? $_POST['filename'] : '' ; $filecontent = (isset($_POST['filecontent'])) ? $_POST['filecontent'] : '' ; if (saveFile($filename,$filecontent) == 1){ echo "File was saved"; } else if (saveFile($filename,$filecontent) == -2){ echo "An error occured during saving file"; } else if (saveFile($filename,$filecontent) == -1){ echo "Wrong file name"; } } ?> thank you alot it will really helps me alot I have found a point in my site where the user may wish to go back a page. Using the back button in the browser works perfectly fine. However, for aesthetical reasons and for "obvious function" reasons i need to create a button on the page which goes back a step in the browsers history. I know I can do this with Javascript, but I would rather get it done with php first. Therefore is it possible to create a back button in PHP. The back button in question will go back one step in the browsers history to the same .php it is currently on but in a previous state. I found this from google, http://www.webmasterworld.com/forum88/870.htm, but then found there was some js in the answers. I cannot find any other posts similar to this in php freaks $i = 0; while($i < 10) { if ($i == 7) { //Do Function } else { $i++ Go back to beginning of loop } //More if statements here. } |