PHP - Getting The Id Back, But No Variables
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 Similar TutorialsI have been banging my head against a wall for a few days over this and think that I have read so many alternative ways, I have got myself confused! What I am trying to do is post some information into the database and on success, provide certain variables back to my script (for example last_insert_id) as I would like to show a success message an add an option to a select on that page. I am trying to get this part working without the mysql first just so I understand it. Currently I can post the data, have that received successfully in the processing page (addDetail.php) and send back output from that page........ insert.php $("#sub").click(function() { var name = $("#name").val(); var town = $("#town").val(); jQuery.ajax({ type: "POST", url: "postScripts/addDetail.php", data: 'name='+name+'&town='+town, success: function(html) { $(".modal-body").prepend( "Returned: " +html ); } }); return false })addDetail.php $name = $_POST['name']; $town = $_POST['town']; //Check $_POST data echo "<pre>"; print_r($_POST) ; echo "</pre>"; $return["name"] = $name; $return["town"] = $town; echo json_encode($return); Result in insert.php Returned: Array ( [name] => The Name [town] => The Town ) {"name":"The Name","town":"The Town"}This works fine to bring back everything on the processing page in one go but I want to bring back separated variables so I can use them individually. I thought that changing "Returned: " +htmlto "Returned: " +html.namewould allow me to bring back just that variable but it comes back undefined. This is the closest I have got as other methods I tried either brought nothing back or just [objectObject]. How would I be able to bring back both 'name' and 'town' as separated values so I can use them individually in my script? Thanks in advance Steve Edited by MargateSteve, 29 September 2014 - 08:41 AM. OK, I think this should belong on this board. I am trying to write something that does the following (simplified for ease of understanding): User has signed into my website and has a session variable with their user id in it. There is a table in the mySQL databse that contains details about the user. (this part is already working) User wants to pay for a trip, so clicks a customised Paypal button that takes him to the Paypal site. The item has an trip id associated with it. Once the transaction has been completed, I want to feed information back to my website, and insert the 'item id' and 'user id' into a field in a table in the database. Any idea how I might do this!? Whilst I have a basic script that will insert a row into my table, it relies on variables being sent from the page it is on, thus will not work when the user is redirected to Paypal, as I cannot find a way to send variables to paypal about the item, and then have them send it back to me once the transaction is complete. My PHP is self-taught so sorry if this way of doing things seems a bit scrappy. Hey ive been wanting to know how to make a function call another function which will then create a variable which i can send back to first function where i can use it. I tried somthing like this Code: [Select] <?php a(); function a($wall) { b(); echo $wall; } function b() { $wall = "test"; #a($wall); } ?> Thats what i tried but ofcourse didnt work, how would i go about doing this? Thanks. 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>"; ?> does anyone know how to decode this XML variable value into string values? I also need to know the oposite way: creating variable values into xml. I've tried several code examples but they did filter the requested data. Code: [Select] $xml='<?xml version="1.0" encoding="utf-8"?> <elements> <text identifier="ed9cdd4c-ae8b-4ecb-bca7-e12a5153bc02"> <value/> </text> <textarea identifier="a77f06fc-1561-453c-a429-8dd05cdc29f5"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <textarea identifier="1a85a7a6-2aba-4480-925b-6b97d311ee6c"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <image identifier="ffcc1c50-8dbd-4115-b463-b43bdcd44a57"> <file><![CDATA[images/stories/red/cars/autobedrijf.png]]></file> <title/> <link/> <target/> <rel/> <lightbox_image/> <width><![CDATA[250]]></width> <height><![CDATA[187]]></height> </image> <text identifier="4339a108-f907-4661-9aab-d6f3f00e736e"> <value><![CDATA[Kramer 5]]></value> </text> <text identifier="ea0666d7-51e3-4e52-8617-25e3ad61f8b8"> <value><![CDATA[6000 RS]]></value> </text> <text identifier="90a18889-884b-4d53-a302-4e6e4595efa0"> <value><![CDATA[Eindhoven]]></value> </text> <text identifier="410d72e0-29b3-4a92-b7d7-f01e828b1586"> <value><![CDATA[APK Pick up and return]]></value> </text> <text identifier="45b86f23-e656-4a81-bb8f-84e5ea76f71f"> <value><![CDATA[15% korting op grote beurt]]></value> </text> <text identifier="3dbbe1c6-15d6-4375-9f2f-f0e7287e29f3"> <value><![CDATA[Gratis opslag zomerbanden]]></value> </text> <text identifier="2e878db0-605d-4d58-9806-8e75bced67a4"> <value><![CDATA[Gratis abonnement of grote beurt]]></value> </text> <text identifier="94e3e08f-e008-487b-9cbd-25d108a9705e"> <value/> </text> <text identifier="73e74b73-f509-4de7-91cf-e919d14bdb0b"> <value/> </text> <text identifier="b870164b-fe78-45b0-b840-8ebceb9b9cb6"> <value><![CDATA[040 123 45 67]]></value> </text> <text identifier="8a91aab2-7862-4a04-bd28-07f1ff4acce5"> <value/> </text> <email identifier="3f15b5e4-0dea-4114-a870-1106b85248de"> <value/> <text/> <subject/> <body/> </email> <link identifier="0b3d983e-b2fa-4728-afa0-a0b640fa34dc"> <value/> <text/> <target/> <custom_title/> <rel/> </link> <relateditems identifier="7056f1d2-5253-40b6-8efd-d289b10a8c69"/> <rating identifier="cf6dd846-5774-47aa-8ca7-c1623c06e130"> <votes><![CDATA[1]]></votes> <value><![CDATA[1.0000]]></value> </rating> <googlemaps identifier="160bd40a-3e0e-48de-b6cd-56cdcc9db892"> <location><![CDATA[50.895711,5.955427]]></location> </googlemaps> </elements>'; Hi. I have some code which needs to return a single variable from the function and stored as a variable within this page, so it can be echoed later on in the page. I couldn't get it to return as a variable, so i used "return compact();" to return the variable and "extract (myFunction());" to extract it to variables. However, when I turned on php's display errors and error reporting function, I got an error message saying "Warning: extract() [function.extract]: First argument should be an array in /my/web/site/index.php on line 6" (which is where my extract function is). This works fine with passing more than one variables through, is there another way pass one variable from a function to be stored as a variable on the page which called the function? Here is the function: Code: [Select] <?php //This is a list of numeric error codes against their text. this will return the error code as the variable $issue function checkLoginIssue() { //If there is an error code if (isset($_GET["issue"])) { //cycle through the list until the code is reached, return the text and break the switch switch ($_GET["issue"]) { case "1": $issue = '<p class="warning">Please log in to view this page</p>'; break; case "2": $issue = '<p class="warning">Wrong Username or Password</p>'; break; case "3": $issue = '<p class="warning">No user found with those details</p>'; break; } //return the variable in an array with a single value return compact('issue'); } } ?> And here is the code which calls the function: Code: [Select] <?php extract(checkLoginIssue()); ?> 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. 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> And we're back online... again! It may have taken 3-4 days, but we're back.
Hello everyone! I am a new user and I have a simple question. How to download the database and create a backup. $i = 0; while($i < 10) { if ($i == 7) { //Do Function } else { $i++ Go back to beginning of loop } //More if statements here. } I am getting strange behavior after a user submits a comment. After they comment on an article, I display a success message with two buttons: "Return to Article" and "Go to Home Page" Each button seems to work, and I was even able to "Return to Article" and then hit my browser's Back button to return the original "You Comment was Added" message, but if I hit the Back button after hitting "Go to Home Page" I got this error... Quote Notice: Undefined index: pageTitle in /Users/user1/Documents/DEV/++htdocs/01_MyProject/add_comment.php on line 39 Call Stack On Line 39 I have this code... Code: [Select] // Set Page Title. $pageTitle = $_SESSION['pageTitle']; It seems to me that if a user hits the Back button in general it will often cause problems, so is there a way to handle this?? I'm not exactly certain is causing the error above in the first place since my SESSION should be intact.... Debbie Perhaps a simple task... I did ASP coding before, now I'm into PHP. So I'm a newbie in PHP. 2 arrays : $array1 = array("1","2","3","4"); and $array2 = array("1","2"); In array2 you'll find the numbers that need to be excluded from array1. So I should have als result 3 and 4. I tried since 2 days now and can only check and exclude 1 number from array2 butnot dynamical ! Code: [Select] $ii = 1; foreach( $arrayLordervalue as $value ) { if( $value == 1 )continue; //komma's tussen de cijfers plaatsen if($ii == 1){ $values[$ii] = $value;} else { $values[$ii] = ",". $value; } $value2= $value2.$values[$ii]; $ii++; } echo $value2; Gives me 2,3,4. I'm completely stuck ! I tried foreach, for ($n...),while... bah what's left ? 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. 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 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 nothing is echoed for the second foreach??? foreach($pictures as $picture) -im breaking cause it's a large file Code: [Select] $doc = new DOMDocument(); $doc->load('accommodation.xml'); $i = 0; $accommodations = $doc->getElementsByTagName('accommodation'); foreach($accommodations as $accommodation) { if(++$i > 2) break; $supplierID = $accommodation->getElementsByTagName('code')->item(0)->nodeValue; $pictures = $accommodation->getElementsByTagName('pictures')->item(0)->nodeValue; $pictures=array(); foreach($pictures as $picture) { echo $url = $picture->getElementsByTagName('url')->item(0)->nodeValue; } }//end //XMl schema <?xml version="1.0" encoding="utf-8"?> <accommodations> <accommodation> <code>1</code> <pictures> <picture> <url>http://example.com/images.k.jpg</url> </picture> </pictures> 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 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! |