Search the Community
Showing results for tags 'get'.
-
How do add $_GET['return'] to get output $input['return'] like i have $input['username'] and add value null if no return url detected? <?php $errors = array(); /* Form is not submitted */ $input = array( 'username' => NULL, 'password' => NULL, 'remember' => NULL ); /* Form is submitted */ if(filter_has_var(INPUT_POST, 'submit')){ $defs_POST = array( 'username' => FILTER_SANITIZE_STRING, 'password' => FILTER_UNSAFE_RAW, 'remember' => FILTER_SANITIZE_STRING ); $input = filter_input_array(INPUT_POST, $defs_POST); if(empty($input['username'])){ $errors[] = 'Please enter your username.'; } if(empty($input['password'])){ $errors[] = 'Please enter your password.'; } } if(filter_has_var(INPUT_POST, 'submit') and empty($errors)){ print "Username = '".$input['username']."', Password = '".$input['password']."', Remember = '".$input['remember']."', Return = '".$input['return']."'"; /* if(!empty($input['return'])) redirect(urldecode($input['return'])); else redirect('index.php?do=home'); */ } print " <form method='post'> Username <input type='text' name='username' value='".$input['username']."'><br> Password <input type='text' name='password' value='".$input['password']."'><br> Remember me <input type='checkbox' name='remember' value='Yes'><br> <input type='submit' name='submit' value='SUBMIT'> </form>"; ?>
-
Hello, i would like to know to how to make this script work. I get information using this link below in index.php, after i get the information i want to insert/update in database information which i don't show on the page self. index.php <?php echo '<a href="example.com?url='. $row['url'] . '&name='. $row['name'] .'&info='. $row['info'] .'&privat='. $row['privat'] .'" target="_blank">Edit</a> ';?> So like this here below i show the information. get_info.php <?php echo $_GET['name']; ?> Which works fine. So now updating the database. $ip_address = $_SERVER['REMOTE_ADDR']; // Ip address works fine $name = $_GET['name']; // not working $r_name = $_POST['$name']; // not working $r_name= 'test'; // this is working. mysql_query("insert into r_test (r_name,r_ip) values('$r_name','$ip_address')") or die(mysql_error()); So how can i get the value and insert in database, only row r_ip is updated with the ip address. I hope i explained it well Thanks in advance.
-
This is posting to any row in mssql that has a matching 'start_date'. I would like it to post rows where start_date = '$start_date' and it also matches the 'meter_id' . It should perform this check of both parameters before posting to mssql. <?php $session_id = $_SESSION['id']; $comm_id = $_GET['meter_id']; $start_date = $_GET['start_date']; $payment_date = $_POST['payment_date']; $amount_paid = $_POST['amount_paid']; $check_number = $_POST['check_number']; $sql = "UPDATE [radiogates].[dbo].[ops_invoice_history] SET payment_date = '$payment_date', amount_paid = '$amount_paid', check_number = '$check_number' where start_date = '$start_date'"; $query = sqlsrv_query($conn, $sql); Thank you for any help.
-
Just curious how other people feel about this. I am working on an application where a lot of info is pulled from MySQL and needed on multiple pages. Would it make more sense to... 1. Pull all data ONCE and store it in SESSION variables to use on other pages 2. Pull the data from the database on each new page that needs it I assume the preferred method is #1, but maybe there is some downside to using SESSION variables "too much"? Side question that's kind of related: As far as URLs, is it preferable to have data stored in them (i.e. domain.com/somepage.php?somedata=something&otherdata=thisdata) or use SESSION variables to store that data so the URLs can stay general/clean (i.e. domain.com/somepage.php)? Both are probably loaded questions but any possible insight would be appreciated. Thanks! Greg
-
Hello, I want to grab some data from this site, using a script. But I am stuck right at the beginning. If you go to the site, you can make a selection with the drop-down-boxes and get some output. For example if you select (left side: text on page in dutch / right side: translation in english): Selecteer competitienaam: Najaarscompetitie 2014 Select league name: Autumn League 2014 Selecteer competitiegroep: Eredivisie dames Select league group: Eredivisie ladies Selecteer weergave: Programma (incl. uitslagen en stand) Select view: Program (including results and position) Optioneel poule filter: De Treffers R Optional group filter: De Treffers R Selecteer poule(s): Eredivisie - Poule A Select group(s): Premier League - Group A I want to grab the output you get after making all the selections. When I look at the webbrowser's page source the selections (drop-down-boxes) are inside an iframe from another domain: <iframe src="http://www.nttb-competitie.nl/" width="100%" height="1200" scrolling="yes" frameborder="0" name="NTTB_Competitie"></iframe> I figured out: First, the script gets url: http://www.nttb-competitie.nl/selectie.php?anr=0 And after last selection it gets url: http://www.nttb-competitie.nl/web_programma.php?reset=0&pidString=1009267&sc=0&vastgesteldeAfdelingsnr=0&cnid=10085&cid=10704&view=programma&pf=1269&pid=1009267 My problem is when I copy those URL's in a webbroser 's address bar, I get a page with only the words: Ongeldige aanroep! Which means "Invalid Call!" So my question is: How can I grab the data instead of this stupid message? Is it even possible or is it somehow protected? Please help!
- 1 reply
-
- grab
- server-data
-
(and 3 more)
Tagged with:
-
I have a system that I want to change. it works like today that I connect to the server and sends the data to a file. fine. roughly looks like this. connecting to server and I send this. : GET /invput?id=sr1234&data=1,2,3,4,5,6,7,8,9 HTTP/1.1 fine. what I do not understand is "/ invput?" I have learned a different way of doing it that I send to a .PHP file which then create a file in which data is stored in. but "invput" is a library right?
-
im having a simple html form that gets variables via 'POST' and passes them to simple.php, the simple.php file constructs a new link with the $_POST[] - and all i want to do is creating a simple iframe (this script is only for internal uses) underneath the form that will open the new link that was created within simple.php to clarify it a bit more here's form.html <form name="Students Management" action="http://myowntest.com/simple.php" method="post" accept-charset="utf-8"> <p> <label>First Name</label> <input type="text" value="" name="firstname" ></input> </p> <p> <label>Phone</label> <input type="text" value="" name="phone" ></input> </p> <p> <label>Last Name</label> <input type="text" value="" name="lastname" required="true"></input> </p> <p> <label>Company</label> <input type="text" value="" name="school" required="true"></input> </p> <p> <label>Email</label> <input type="text" value="" name="email" ></input> </p> <p> <label>Country</label> <input type="text" value="" name="age" ></input> </p> <p> <input type="submit" value="Submit" ></input> </p> </form> and here's simple.php <?php $newUrl = 'http://www.myothertestspace.com/simlpe2.php?name=' . $_POST['name'] . '&surname=' . $_POST['lastname'] . '&phone=' . $_POST['phone']; header(Location: $newUrl); ?> now, all i want is - after the user 'submits' the details on form.html , i'd like a new iframe will be shown up in the same page as the form that will show the user the contents of simple.php (which means - myothertestspace.com with the new parameters). thanks a lot!
-
I didn't notice this until know. Say I have a url like this. http://www.yoursite.com?category_id=3&category_name= Grocers & Shoppers When I get the the category name using $_GET, it'll only echo 'Grocers' and not the full word 'Grocers & Shoppers'. Anyone can tell me what's happening?
-
I am trying to set variables with $_GET from the url... caption.php?image=53348b3068f36.jpg&topcaption=sdfas&bottomcaption=asdfadf if (isset($_GET['image'])){ $picture = $_GET['image']; $topcaption = $_GET['topcaption']; $bottomcaption = $_GET['bottomcaption'];
-
I'm trying to use JavaScript to redirect to a PHP page that GETs a logout variable and checks to see if it's true. This is what I have function logout() { window.location.href = "index.php?logout=true"; } When I invoke the logout() function, it redirects to "index.php?". It completely ignores the "logout=true" part. How can I fix this?
-
Hey guys I am new here, I am trying to Get from my Api,Im using curl in php to log into on one page and then get another page passing all cookies from the first page along with you but I keep getting Access denied!! $ch = curl_init(); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookieFileName"); curl_setopt($ch, CURLOPT_URL,"http://www.supersaas.com/api/users"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "?account=myname&password=mypassword"); ob_start(); // prevent any output curl_exec ($ch); // execute the curl command ob_end_clean(); // stop preventing output curl_close ($ch); unset($ch); $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_COOKIEFILE, "/tmp/cookieFileName"); curl_setopt($ch, CURLOPT_URL,"http://www.supersaas.com/api/users?id=12"); $buf2 = curl_exec ($ch); curl_close ($ch); echo "<PRE>".htmlentities($buf2); What's wrong with the code????
-
i'll looking for a snippet of code in php to post a set of variables to a url and then display the return data. example: &field1=a&field2=b&field3=3 https://www.example.com/dir/ i searched for a few hours and cannot put the code together. most of the php sites talk about post and get functions, but i cannot find a good, rather working, example. do i need two php pages, one to call the other? do i use html form submit? what tells the page to just display/print the response. i'm sure i can figure out how to parse the info but i'm stuck on first step, post-get data. thanks in advance!
-
hello, i am new to php programming.. i need to execute this url in my send sms.php file.. i tried curl method but failed.. API URL is , sample" http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=hidden&password=hidden&sendername=iZycon&mobileno=8289947807 i just need to execute this url in my page... while replying plz include the php code..
-
Hey all, I'm desperately trying to find an answer to this issue. I pretty much can't go on holiday until I resolve this one damn thing.. so if you can nail it for me, you're quite literally buying me some well deserved downtime and I'll be super stoked!! http://stackoverflow.com/questions/20810551/filling-a-text-field-in-a-php-form-field-with-passed-url-data Thanks. B
-
Dear pals, I am newbie in RESTful services . I need to call a GET Verb in Server . I know 2 methods 1. Ajax Call we can write it as $.ajax({ url: url, dataType: "html", type: 'GET', data: "id="+id+"&type="+type, success: function(data){ //$("#content").html(data); alert(data); $('table #sample-boxed-2-pagination th a').each(function(){ //this.href = this.href.replace(sub_url, main_url); var value = this.href.split('?'); //alert(value[0]); if(value[0]!=sub_url) { this.href = this.href.replace(value[0], sub_url); } }); } }); }); But I know it's not working in Cross domain scenario . Please advise a method to work same in all domains . 2. Using file_get_contents() function like $response = file_get_contents('https://kkl.com/graph/call?parm1=9'); I know I can call POST verb using cURL as $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "http://localhost/simple_rest_master/test"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $data = array( 'username' => 'foo', 'password' => 'bar' ); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $contents = curl_exec($ch); curl_close($ch); echo $contents; // manipulate response Do you can advise the syntax of GET call using cURL ? Waiting your fast reply Thanks, Anes
-
Hello, right now, I am making a PHP page and I want to know how to make PHP detect what I call 'URL or domain extensions'. For example, if the URL is index.php?code=123 , The URL is 'index.php' and The extension is ?code=123 I want to get the '123' value from the 'code' prefix to a variable so I can use it for other things like #import 123 to variable 'code' echo "$code"; Please tell me how this happens. Thx. P.S. If my English is faulty please forgive me.
-
hello, i am using google scripts for finding the location base ot search city or street.. everything is working if i am searching from the same index by input tag with some id.. the button is executing some javascript. i am trying to make the search by giving parameter from other index - with $_GET['location']. after that i put one rule - if($_GET[location]){ echo "<script type javascript.. function()." but nothing happens. in the function i put one alert after the if(thislocation), to see if the parameter is givven to the function ant id is, but the location didnt appear. can you help me to understand what i am missing. function submitQuery(thislocation) { if(thislocation){var query=thislocation} else { var query = document.getElementById("location").value; } if (/\s*^\-?\d+(\.\d+)?\s*\,\s*\-?\d+(\.\d+)?\s*$/.test(query)) { var latlng = parseLatLng(query); if (latlng == null) { document.getElementById("location").value = ""; } else { geocode({ 'latLng': latlng }); } } else { geocode({ 'address': query }); } } function geocode(request) { resetMap(); var hash = ''; if (request.latLng) { hash = 'q=' + request.latLng.toUrlValue(6); } else { hash = 'q=' + request.address; } hashFragment = '#' + escape(hash); window.location.hash = escape(hash); geocoder.geocode(request, showResults); } function parseLatLng(value) { value.replace('/\s//g'); var coords = value.split(','); var lat = parseFloat(coords[0]); var lng = parseFloat(coords[1]); if (isNaN(lat) || isNaN(lng)) { return null; } else { return new google.maps.LatLng(lat, lng); } } <input type="text" id="location" style="width:93%; height:30px; font-size:15px;" class="logbut" placeholder="<?php echo $lang['mapinfo'];?>" > </td> <td align="right" style="min-width:46px; vertical-align:middle"> <input type="button" value="<?php echo $lang['search'];?>" class="newclassbutton" onclick="submitQuery()"/> <?php if($_GET['location']){?><script type="text/javascript">submitQuery('<?php echo $_GET['location'];?>')</script><?php } ?>
-
I'm trying to get a query expansion sort of effect that shows suggestions for misspellings and then lets you click them to input them in to your form. So I have passed a variable through a hyperlink but I can't seem to GET it in to the "value" field <form method="POST" action='AllinOneMonstaaa.php'> <label for="query">Query</label><br/> <input name="query" type="text" size="60" maxlength="60" value="<?php echo ($_GET['query']);?>" /><br /><br /> Notice the $_GET. I want it to be auto-filled if a user has selected an option in the previous page from the following php file. if ($s_count > 1) { echo ('<h4>Did you mean?</h4>'); while ($ss_count <=$s_count) { echo '<a href = "AllinOneMonstaaa.php?query='.$suggestion[$ss_count].'">'.$suggestion[$ss_count].'</a><br>'; $ss_count++; } }
-
Hi All, I have a script that relies on a numeric variable from GET. I am trying to figure out how to have a 'default' value if no GET value is passed in the url. I have been trying to get it to work with if() but no joy: $par2 = $_GET['par1']; if(empty($par2)) { $par = 4; } $par = $par2; So if a value for 'par1' is passed in the url then $par will be whatever that value is. However if no value is passed then the default value for $par should be 4. Unfortunately that code doesn't seem to work. If i pass no 'par1' value in the url i jest get a php error. Any tips on where im going wrong here would be much appreciated. Thanks in advance for any help, Matt
-
I am using jqforms to create simple forms and populate them from SQL data. This works fine when hard coded (eg search for ID with value x). However when I try to populate from $_GET values, it does not work, and I am going insane trying to understand why. First there is a simple PHP with my website menu (Main.php). Then it php-includes the php file (Form.php) containing my form. <?php include ("Form.php");?> This works and the forms work 100%. The URL accessed: www.website.com/Main.php?val=10254 In Form.php there is a simple SQL Select command. 'SELECT OrderID, ShipName FROM orders WHERE OrderID = '. $value .''; Above this, as a test, the $value is simply hardcoded. $value = 10254; This loads the database perfectly to the correct ID. It echoes this exact line (I realize echo will break the rest of the code, but just to test the output): SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Okay. So everything is fine. Now here is the problem. Replace the hard-coded $value with: $value = $_GET['val']; It will echo this: SELECT OrderID, ShipName FROM orders WHERE OrderID = 10254 Which as you can see is the exact same thing as hard coded. And yet, remove the echo, and it will not load. What the hell is going on? I have lost 2 days so far because of this! It is literally echoing the same thing so why does it do nothing? My only guesses are how the value is being passed, and something to do with including the Form.php in the Main.php. The only reason I do that is that is how the jqform works (it for some reason does not work if you copy-paste the Form.php contents into Main.php... weird). Thank you for any help.
-
Hi all, So I have a page which uses mysql_query to select some variables from a table, and then produces an array in order to plot this information on a graph (data used for this depends on the unique id which is obtained by $_GET [‘mrn’]. This is all working fine. However, what I want to do now is include multiple copies of these graphs on a single page (graphs for different mrn’s). I tried to do this by including the files like this: <php $_GET[mrn] = "1"; include('graph.php'); ?> //some html <php $_GET[mrn] = "2"; include('graph.php'); ?> The problem with this method has been that although it works once, the second you include a second graph it stops working (presumably because I have tried to assign two different values to the same variable by effectively defining it twice?) My question is therefore, is there some way to include a file, get its output (draw its graph), and then stop including it, so that I can start including the next file (drawing next graph). My reading so far has led me to believe there probably isn’t a way? Am I correct about that? Does anyone have any ideas about how I might get this working using a different technique? Thanks in advance for any help, Matt
-
I have a drop down form that the user selects to change the number of items shown per page <form id="pagesize" action="<?php $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; ?>" method="get"> <select class="paginate" name="caption" onchange="this.form.submit()"$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; ?> <option caption=4 value=4>4</option> <option caption=5 value=5>5</option> <option caption=10 value=10>10</option> <option caption=25 value=25>25</option> </select> </form> the problem is that whenever someone perform a get request on the page the POST data disappears. Does anyone know any way in which we can solve this. We can post to the page fine, the print_r of post shows this when we head to the page: Array '/Search_form/search_results.php?photograpgher_id=1&photographer=x&image=x&Submit=Search&page=1' its only when we do a get request on the page we have a problem as the post data does not follow through with the get request we only get the this array '/Search_form/search_results.php?caption=5' but it should be '/Search_form/search_results.php?photograpgher_id=1&photographer=x&image=x&Submit=Search&page=1?caption=5' as I have type this in manually and works fine any help would be appreciated
-
Hi, I'm just wondering but how would I go about making a query so that I can fetch two valid pieces of information and display them? So In this case I would like to query my database to find the correct Firstname and Lastname of that use through their session? Here's something I made, it works! But it only fetches the first result and doesn't return the correct name for the correct user. <?php if ($stmt = $mysqli->prepare("SELECT id, firstname, lastname FROM users WHERE id LIMIT 1")) { $stmt->execute(); $stmt->store_result(); $stmt->bind_result($user_id, $firstname, $lastname); $stmt->fetch(); if($stmt->num_rows == 1) { $_SESSION['user_id'] = $user_id; $_SESSION['firstname'] = $firstname; $_SESSION['lastname'] = $lastname; echo $firstname; echo ' '; echo $lastname; } } ?> So at this point it's displaying two names but they are the first record in my database and it's not displaying the correct name for the correct user so for example.: I'm user 6 in the database with the name John Doe but it's displaying record 1 in the database which is Luke Void, basically I want it so when John Doe logs into his account, it says on the screen 'John Doe', so it matches the correct client. Help on this one please, I'm kind of newish to databases... thanks
-
I need some help with the following code. I want it to go through the "bom_terms" table in which $money and $timeframe should be found based on the start date and end date comparisons I am having trouble with. Full Transactions code: /* Transactions */ echo "<h2>Transactions - <a href=\"../transactions/add.php?account=$account\">Add</a></h2>"; if($stmt = $mysqli->prepare("SELECT type, amount, reason, repayplan, repaid, transid, date FROM bom_transaction WHERE account = ? ORDER BY id")); { $stmt->bind_param('i', $account); $stmt->execute(); $stmt->store_result(); $count = $stmt->num_rows; $stmt->bind_result($type, $amount, $reason, $repayplan, $repaid, $transid, $date); if ($count == "0") { echo "<i>No transactions were found.</i><br>"; } while ($stmt->fetch()){ if ($type == "0") {$type = ""; $color = "";} if ($type == "1") {$type = "Added"; $color = "green";} if ($type == "2") {$type = "Removed"; $color = "red";} if ($type == "3") {$type = "Repaid"; $color = "";} if ($repayplan == "0") {$repayplan = "No";} if ($repayplan == "1") {$repayplan = "Yes";} if ($repaid == "0") {$repaid = "No";} if ($repaid == "1") {$repaid = "Yes";} $stmt2 = $mysqli->prepare("SELECT money, timeframe FROM bom_terms WHERE account = ? AND startdate <= '2013-01-03 21:00:00' AND enddate >= '2013-02-20 21:00:00'"); $stmt2->bind_param('i', $account); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($money, $timeframe); $stmt2->fetch(); $stmt2->close(); $date2 = date("M d, Y", strtotime($date)); echo "<font color=\"$color\">$type $$amount</font> $money/$timeframe $reason $repayplan $repaid $date2 <a href=\"../transactions/edit.php?transid=$transid\">Edit</a><br>"; } $stmt->close(); } echo "<br>"; Part of Coding Asking About (From the above): $stmt2 = $mysqli->prepare("SELECT money, timeframe FROM bom_terms WHERE account = ? AND startdate <= '2013-01-03 21:00:00' AND enddate >= '2013-02-31 21:00:00'"); $stmt2->bind_param('i', $account); $stmt2->execute(); $stmt2->store_result(); $stmt2->bind_result($money, $timeframe); $stmt2->fetch(); $stmt2->close(); What's it's doing: It's making all results from the "bom_terms" table the same when at least 2 of the results should be different (meaning from a different row of the "bom_terms" table). - Right now it is grabbing the last result found from the table. Not sure why however. Some tests/theories I tried made it so it did show a different row, but they were still all shown as the same. Example (what it is doing now): ---Example--- Added $10.00 40.00/Every 2 Weeks No No Jan 31, 2013 Edit Added $90.00 40.00/Every 2 Weeks No No Feb 05, 2013 Edit Added $20.00 40.00/Every 2 Weeks No No Feb 19, 2013 Edit Removed $46.00 40.00/Every 2 Weeks Vengenz Birthday Party/T-Shirts Yes No Feb 22, 2013 Edit Added $100.00 40.00/Every 2 Weeks No No Mar 05, 2013 Edit ---END Example--- NOTE: The 40.00/Every 2 Weeks is the result from the "bom_terms" table. Example (what I want it to do): ---Example--- Added $10.00 20.00/Every Week No No Jan 31, 2013 Edit Added $90.00 20.00/Every Week No No Feb 05, 2013 Edit Added $20.00 20.00/Every Week No No Feb 19, 2013 Edit Removed $46.00 40.00/Every 2 Weeks Vengenz Birthday Party/T-Shirts Yes No Feb 22, 2013 Edit Added $100.00 40.00/Every 2 Weeks No No Mar 05, 2013 Edit ---END Example--- NOTE: The 40.00/Every 2 Weeks and 20.00/Every Week are the results that would be from the "bom_terms" table. I am hoping there is just a simple problem/error I don't see. .. . . Hopefully you can understand what I am asking and having trouble with - I had a hard time trying to come up with a good way to explain it - this is the best way I could come up with.
- 13 replies
-
- mysql date
- before and after
-
(and 3 more)
Tagged with:
-
i searched on google and can't seem to come up with an answer. I keep getting linked to some wiki article about cookies or something. Is there a way to disable the button after submit. or force user to click an "edit" button to enable "update" button? The website is below. Basically you enter the available apartment (select landlord, building, enter price, apt #, # of bedrooms). Hit enter. Added to database. http://responsiblyvodka.com/tester.php if you hit refresh it either reenters it or enters a blank line.