PHP - Moved: Strange Problem With Post Data Not Showing
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=325313.0 Similar TutorialsHi folks, I have an initial redirect page which directs to my main page, sending two reference variables as $_GET parameters: Code: [Select] header("Location: /ob/index.php?id=".$id."&ref=".$ref); The first thing this main page does is include a file which checks for those two values: Code: [Select] if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); session_start(); error_reporting(E_ALL); if (isset($_GET['id']) && isset($_GET['ref'])){ $_SESSION['id'] = $_GET['id']; $_SESSION['ref'] = $_GET['ref']; } if(!isset($_SESSION['id']) || $_SESSION['id']=="" || !isset($_SESSION['ref']) || $_SESSION['ref']==""){ echo ("This service requires a valid ID to run - your session may have expired, please refresh your browser to try again."); exit; } The main page loads fine - meaning that the $_SESSION variables have been set correctly. However, when the next page loads (including the same file), the $_GET values obviously aren't there but the $_SESSION variables should be intact. I am getting fails every time though in Opera and Safari (have checked in IE, FF and Chrome and all seems well). However, if I then refresh the browser - in both Opera and Safari - the next page loads fine and the $_SESSION variables are correctly set. Any ideas on this at all? Many thanks in advance, Rich This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=349304.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315683.0 I am using html5 and all the pages have h2 headings as titles. They all show up in google search results fine. The only thing that doesn't show up fine are some of the descriptions under each heading. Some meta descriptions show up fine under the correct heading title, while rest shows ALL the heading tags AS description under each search result.
For eg.
Cars
www.mywebsite.com/category?id=5&name=cars $post='{"cart_items":[{"configuration":{"price":100,"recharge_number":"9999999999"},"product_id":"999","qty":1}]}';i try this n reslut was :There are no valid items in cart: help me plz Edited by ShivaGupta, 30 November 2014 - 01:11 AM. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=309496.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=359434.0 here is my code , its supposed to show a picture , but it doesnt i use a function in a function ... function posts Code: [Select] function posts($query, $action_type) { $session = $logOptions_id; if($action_type=="newPost") { $class = "class='new'"; } else { $class = ""; } while($row = mysql_fetch_array($query)) { $id = $row['id']; $to_id = $row['to_id']; $from_id = $row['from_id']; $post = stripslashes(linkify(nl2br(htmlentities($row['post'])))); $type = $row['type']; $state = $row['state']; $date = time_stamp($row['date']); ?> <li id=<?php print $id?>> <div class="post-left"></div> <div class="post-right"> <!---ARROW--> <div class="arrow-border"><div class="arrow"></div></div> <div class="post-body"><div class="post-Spic"><?php Spic($from_id, 55)?></div><?php print $post?></div> <div class="post-top"> <a class="post-name" href="profile.php?id=<?php print $from_id?>"><?php name($from_id)?></a> | <a href="#/posts&id=<?php print $id?>" class="post-date" title="<?php print date('l, jS \of F, Y \a\t g:ia ', $row['date']);?>"><?php print $date?></a> | <a class="post-comment" id="comment-toggle<?php print $id?>" onClick="comment_toggle('<?php print $id?>')">Comment</a> |<?php/*<a class="post-like" id="PostLike<?php print $id?>" onClick="<?php print $like_unlike?>('<?php print $id?>')"><?php print ucwords($like_unlike)?></a> <div class="num-likes" id="NumLikes<?php print $id?>"><?php print $num_likes?>*/?></div> </div> </li>function Spic Code: [Select] function Spic($id, $px) { if($px) { if($px>=0&&$px<=42) { $size = "_30"; } else if($px>=43&&$px<=70) { $size = "_55"; } else if($px>=71&&$px<=97) { $size = "_85"; } else if($px>=98&&$px<=155) { $size = "_110"; } else if($px>=156&&$px<=425) { $size = "_200"; } else if($px>=426) { $size = "_650"; } } else { $size = ''; } { $check_pic = "members/$id/image01.jpg"; $default_pic = "members/0/image01.jpg"; if (file_exists($check_pic)) { $user_pic = "<img src=\"$check_pic?$cacheBuster\" $size />"; } else { $user_pic = "<img src=\"$default_pic\" $size />"; } } I had a wordpress site setup for my maintenance company. I am not trying to setup a blog on the site. I have the blogroll showing up on this page: http://handymore.com/blog/ but when you click the individual articles the single post page shows a Error 404 message. Could anyone point me in the right direction as to how to fix this so that the individual post pages are found? Any guidance would be appreciated. This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=333290.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=331683.0 For some reason the line commented // executes unexectedly does exactly that Any ideas why? if ($_POST['user'] == null){ $errors[] = 'An Interviewer ID is Required'; }elseif ($_POST['task'] != 'receipting' || $_POST['task'] != 'dataentry'){ $errors[] = 'Invalid Task'; // EXECUTES UNEXPECTEDLY } if (!empty($errors)){ print_LoginForm($errors); } Code: [Select] echo "</b><select name='task'>\n"; echo "<option value='receipting'>Receipting</option>\n"; echo "<option value='dataentry'>Data Entry</option>\n"; echo "</select>\n"; I'm trying to have a running total of the number of views an image gets. My test file works perfectly every time. The actual file, image_win.php, does not and after much testing can't see what's wrong. This files STRANGENESS: the first two views count fine, with 1 added the total in the field image_visit. But every time after that 2 is added to the total in image_visit. Very bizarre. Thanks for taking a look -Allen Code: [Select] <?php ////////TEST IMAGE_WIN //////////THIS WORKS include_once "scripts/connect_to_mysql.php"; include_once "scripts/paths.php"; $art_id = 372; $QUERY="SELECT user_id FROM artWork WHERE art_id = '$art_id'"; $res = mysql_query($QUERY); $num = mysql_num_rows($res); if($num >0){ while($row = mysql_fetch_array($res)){ $owner_id = $row['user_id']; } } mysql_query("UPDATE userInfo SET image_visit = image_visit +1 WHERE user_id = '$owner_id'"); ?> <?php //////// image_win.php /////////THIS DOES NOT WORK $user_id=$_SESSION['user_id']; include_once "scripts/connect_to_mysql.php"; include_once "scripts/paths.php"; $image_link = $_GET['image_link']; $art_id = $_GET['art_id']; ?> <!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" /> <meta name="viewport" content="width=device-width, height=device-height, target-densityDpi=device-dpi"> <title>Image Window</title> </head> <body bgcolor="#000000" leftmargin="0"> <div align="center" > <img src="slir/w640-h535/<?php echo $path.$image_link.$postCat; ?>" /> <?php $QUERY="SELECT user_id FROM artWork WHERE art_id = '$art_id'"; $res = mysql_query($QUERY); $num = mysql_num_rows($res); if($num >0){ while($row = mysql_fetch_array($res)){ $owner_id = $row['user_id']; } } mysql_query("UPDATE userInfo SET image_visit = (image_visit +1) WHERE user_id = '$owner_id' "); ?> MOD EDIT: code tags added. I am developing hospital managment system using php. I have IPD data sheet. When I select patient it is not showing pt data as it should do. Please let me know if any coding needs to place here. I am new to PHP. Below is my code <?php //create array to temporarily grab variables $input_arr = array(); //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { $_POST[$key] = addslashes($input_arr); } ?> <?php session_start(); $db = mysqli_connect('localhost', 'root', '', 'ratanba_new'); // initialize variables $reg_no = ""; $name = ""; $father_name = ""; $sir_name = ""; $sex = ""; $age = ""; $full_name = ""; $dob = ""; $update = false; $patient_master_id = ""; $ipd_id = 0; $IPNo = ""; $fees = ""; $opd_date = ""; $pulse = ""; $bps = ""; $bpd = ""; $weight = ""; $spo2 = ""; if (isset($_POST['admit'])) { function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = ucwords($data); return $data; } $patient_master_id = $_POST['patient_master_id']; $IPNo = $_POST['IPNo']; $RegNo = $_POST['reg_no']; $Name = $_POST['Name']; $Age = $_POST['Age']; $Sex = $_POST['sex']; $Contact1 = $_POST['Contact1']; $Relation1 = $_POST['Relation1']; $Mobile1 = $_POST['Mobile1']; $Contact2 = $_POST['Contact2']; $Relation2 = $_POST['Relation2']; $Mobile2 = $_POST['Mobile2']; $Adate = $_POST['Adate']; $Award = $_POST['Award']; mysqli_query($db, "INSERT INTO IPD (IPNo, RegNo, Name, Age, Sex, Contact1, Relation1, Mobile1, Contact2, Relation2, Mobile2, Adate, Award) VALUES ('$IPNo', '$RegNo', '$Name', '$Age', '$Sex', '$Contact1', '$Relation1', '$Mobile1', '$Contact2', '$Relation2', '$Mobile2', NOW(), '$Award')"); $_SESSION['message'] = "New Admission Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['Discharge'])) { $ipd_id = $_POST['ipd_id']; $Outcome = $_POST['Outcome']; mysqli_query($db, "UPDATE ipd SET Outcome='$Outcome', Ddate=NOW() WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Patient discharged Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['final_discharge'])) { $ipd_id = $_POST['ipd_id']; $History = $_POST['History']; $Examination = $_POST['Examination']; $Investigation = $_POST['Investigation']; $Advise = $_POST['Advise']; $Diagnosis = $_POST['Diagnosis']; $Treatment = $_POST['Treatment']; $Operation = $_POST['Operation']; $OTnote = $_POST['OTnote']; $Condition1 = $_POST['Condition1']; $Note = $_POST['Note']; mysqli_query($db, "UPDATE ipd SET History='$History', Examination='$Examination', Investigation='$Investigation', Diagnosis='$Diagnosis', Operation='$Operation', OTnote='$OTnote', Condition1='$Condition1', Advise ='$Advise', Treatment='$Treatment', Note='$Note' WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Discharge saved Successfull !"; header('location: ../doctor/discharge.php'); } $results = mysqli_query($db, "SELECT * FROM IPD "); ?> Edited May 8 by Barand Coding was missed The following code should output 1743425391, but it does not show anything <?php $xml_feed_url = 'http://api.eve-online.com/eve/CharacterID.xml.aspx?names=TX1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $xml_feed_url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $xml = curl_exec($ch); curl_close($ch); $xmlr = new SimpleXMLElement($xml); $charid = $xmlr->result->characterID; echo $charid; ?> The xml is: Code: [Select] <eveapi version="2"> <currentTime>2011-02-01 05:22:38</currentTime> − <result> − <rowset name="characters" key="characterID" columns="name,characterID"> <row name="TX1" characterID="1743425391"/> </rowset> </result> <cachedUntil>2011-03-01 05:22:38</cachedUntil> </eveapi> Any ideas where I went wrong? Hi: Can someone tell me why the code below is not displaying any data. It's suppose to write the calendar dates and event info, but nothing is showing up. No errors, either .. ?? Code: [Select] <td width="50" <?=hiLightEvt($month,$i,$year);?>> <?php if(isset($_GET['full'])){ $result = mysql_query($sql); $row = mysql_fetch_assoc($result); echo $row['calName']; }else{ $sql="select calID, calDate, calName, calDesc from calTbl where calDate = '" . $month . '/' . $day . '/' . $year . "'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ echo $row['calName']; ?> <a href="<?=$_SERVER['PHP_SELF'] . '?month='. $month . '&day=' . $i . '&year=' . $year;?>&v=1"><?=$row['calDate'];?></a> <?php } } ?> </td> Help, please .... I am having an issue with the data from page ID 5 not displaying in the form, Why <?php include('includes/header.php'); include('includes/class/class.form.php'); include('includes/class/class.page.php'); $iPageID = 5; if(isset($_GET["PageID"])){ $iPageID = $_GET["PageID"]; } $EditedPage = new Page(); $EditedPage->loadPage(5); $apageInformation = array(); // Information From DB Sticky $apageInformation["name"] = $EditedPage->getPageName(); $apageInformation["content"] = $EditedPage->getPageContent(); $formEdit = new Form('editpage.php?PageID=".$iPageID', 'EditPage','return CheckEditPage();',''); $formEdit->setStickyData($apageInformation); if(isset($_POST["submit"])){ $formEdit->setStickyData = $_POST; $formEdit->checkNotEmpty("Name"); $formEdit->checkNotEmpty("PageContent"); if($formEdit->getValid() == true){ $EditedPage->setPageName = $database->escape_value($_POST["Name"]); $EditedPage->setPageContent = $database->escape_value($_POST["PageContent"]); $EditedPage->savePage(); $Message = "Page Updated"; }else{ $Message = "You Have An Error Mate"; } } $formEdit->openFieldset(); $formEdit->makeInputBox("Name","Name","CheckInput(this.id);"); $formEdit->makeTextArea("Content", "PageContent", "20","70", "CheckInput(this.id);"); $formEdit->makeSubmitButton("submit","Edit Page"); $formEdit->closeFieldset(); $newNavigation = new Navigation(); ?> <?php echo $newNavigation->mainMenu();?> <h1 class="Heading">Edit Page</h1> <?php echo $Message ?> <?php echo $formEdit->getHTML(); ?> <?php include('includes/footer.php')?> Hi all, I want to create a website, where the user can add any number of custom fields, and then put any info there he or she wants. I then need a site to display the info. The problem is that I have no idea on what would be the smartest way to do this. Let's say it was about flowers and they created a "type" field and a "stock" field. How could i make sure, that the correct stock will be displayed with the correct type field? <?php $con = mysql_connect("localhost","user","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("contact", $con); $sql="INSERT INTO contact_info (FirstName, LastName, Phone, Email, ContactMethod, City, State, zip, TimeFrame, Agent, AgentInfo) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[phone]','$_POST[email]','$_POST[contactmethod]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[timeframe]','$_POST[agent]','$_POST[agentinfo]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> That's my code everything seem's to be working fine script runs and says 1 record added however when I go to view the entry phpMyAdmin the entry show's up without the data? Hi I have a little strange problem. I cannot get the post data from my form. It works fine if there is 10 or 15 user but reaching 40 or more than form values not posting. This is output of size: echo (int) $_SERVER['CONTENT_LENGTH']; ===== 22164 Code: [Select] if(isset($_POST['hiddenField'])) { // do some work; } $sql = mysql_query("SELECT id, name FROM user WHERE shop_id = '" .$_SESSION['id']. "' ORDER BY name ASC"); while($row = mysql_fetch_array($sql)) { echo ' <div style="width:100%; border:solid 1px #CCC; background-color:#f1e7e7; margin-bottom:5px;"> <table class="tableSmall"> <tr><th width="81">' .$row['name']. '</th><th width="71">'; echo $grl_pic .' </th> <td width="622"><table width="100%"> <tr>'; for($j=0; $j<7; $j++) { $sql2 = mysql_query("SELECT user_master_id, user_start, user_end FROM work_master WHERE user_master_id = '" .$row['id']. "' AND date = '" .$days_no_kanji[$j]. "'"); $row2 = mysql_fetch_array($sql2); if(mysql_num_rows($sql2) == 0) { $start = "00:00"; $end = "00:00"; $m = 0; } else { $start = $row2['user_start']; $end = $row2['user_end']; $m = 1; } echo ' <th><input type="hidden" name="userData[]" value="' .$row['id']. '_' .$j .'_' .$m. '" /> <select name="' .$row['id']. '_' .$j .'_' .$m. '_start">' .ShopHour($start). '</select><br />~<br /> <select name="' .$row['id']. '_' .$j .'_' .$m. '_end">' .ShopHour($end). '</select> </th>'; } echo ' </tr> </table></td> </tr> </table> </div>'; } Is there someone has any idea why php is not posting? |