Jump to content

Search the Community

Showing results for tags '$_get'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 8 results

  1. I'm trying to get an equation from a user that types it in the url, ex) 1+2+3. I can get the 1,2,3 fine, but the + operator is no longer in the string. Same with the * and / operators. Is there a way to keep them as a string using $_GET?
  2. Hi, I am a curious fellow just beginning to use PHP. I understand the basics of what the $_GET and $_POST superglobals do, and how we can use them to retrieve data after form submission. I also know that since $_GET and $_POST are just associate arrays, we can create our own values in both $_GET and $_POST by writing statements like $_POST['variable'] = "value". I am wondering if it is at all possible to send data beyond form data by adding new key/value pairs into $_GET and $_POST. So for example, if I had a form that transferred username/password through Post, would it be possible for me to include further data by just saying $_POST['formtype'] = "house_insurance_form"? Basically what I'm getting at is trying to physically add your own data to $_POST or $_GET that you could pull from the next page where the form redirects to. In other words, can I send data beyond form data using these superglobals? I know I can do this with $_SESSION, but could I do it through $_POST or $_GET? I haven't been able to accomplish this, and I was just wondering if someone could give me an in-depth explanation of how this might work or how this is not possible. I would really really really appreciate it. Best Regards, -Sky
  3. Hi, I need help getting this thing to work, I'm not sure on how to $_GET[] data after a fragment in the URL. I've seen it used on websites before, for example: example.com/#home?q=test A working example is: http://craftland.org/#map&p=aether This is the code I'm using for the pages: http://pastebin.com/vAHppEyr Any help would be great! Thanks, Kez.
  4. Hello All! I am having an issue with requesting some information for certain blog post. I have written a blog in PHP and have come accross an issue when trying to look up certain articles with certain "Tags". Right now the system pulls up and counts the tag's correctly but when I am trying to click the name of the tag to view post only related to that tag, it keeps giving me trouble. Here is the code I have been using for sending and getting the information. First is the function I am using to count the tags and create a link to use function getTagCount($DBH) { //Make the connection and grab all the tag's TAG TABLE HAS TWO FIELDS id and name $stmt = $DBH->query("SELECT * FROM tags"); $stmt->execute(); //For each row pulled do the following foreach ($stmt->fetchAll() as $row){ //set the tagId and tagName to the id and name fields from the tags table $tagId = $row['id']; $tagName = ucfirst($row['name']); //Next grab the list of used tags BLOG_POST_TAGS TABLE HAS TWO FILEDS blog_post_id and tag_id $stmt2 = $DBH->query("SELECT count(*) FROM blog_post_tags WHERE tag_id = " . $tagId); $stmt2->execute(); $tagCount = $stmt2->fetchColumn(); //Print the following list echo '<li><a href="blog_tags.php?=tagId=' . $tagId . '"title="' . $tagName . '">' . $tagName . '(' . $tagCount . ')</a></li></form>'; //End of loop - start again } } Now here is the code I am using on the page it is being directed too(blog_tags.php) <?php include "includes.php"; $blogPosts = GetTaggedBlogPosts($_GET['tagId'],$DBH); foreach ($blogPosts as $post) { echo "<div class='post'>"; echo "<h2>" . $post->title . "</h2>"; $body = substr($post->post, 0, 300); echo "<p>" . nl2br($body) . "... <a href='post_view.php?id=" . $post->id . "'>View Full Post</a><br /></p>"; echo "<span class='footer'><strong>Posted By:</strong> " . $post->author . " <strong>Posted On:</strong> " . $post->datePosted . " <strong>Tags:</strong> " . $post->tags . "</span><br />"; echo "</div>"; } ?> Here is also the function I am using function GetTaggedBlogPosts($postTags, $DBH) { if (!empty($postTags)) { $postTagsIDsql = "SELECT blog_post_id FROM blog_post_tags WHERE tag_id = :postTagID"; $postTagIDparam = array( ':postTagID' => $postTags ); $postTagIDstmt = $DBH->prepare($postTagsIDsql); $postTagIDstmt->execute($postTagIDparam); $blogstmt = $DBH->prepare("SELECT * FROM blog_post WHERE id = :blog_id ORDER BY id DESC"); $blogstmt->bindParam(":blog_id", $postTagsIDstmt, PDO::PARAM_INT); $blogstmt->execute(); } else { echo 'I apologize about there does not seem to be any post with that related tag.'; } $postArray = array(); $results = $blogstmt->fetchAll(PDO::FETCH_ASSOC); foreach($results as $row){ $myPost = new BlogPost($row["id"], $row['title'], $row['post'], $row['author_id'], $row['date_posted'], $DBH); array_push($postArray, $myPost); } return $postArray; } I am just looking for a point in the right direction and to point out where my break down is happening. Thanks in advanced for your time, learning PHP on my own has been a chore but you all have helped make learning it so much easier.
  5. what does the below piece of code implies? $value1=(isset($_GET['value1']) && $_GET['value1']>0)?$_GET['value1']:20; can someone explain me?
  6. Hello All, First let me say, happy holidays! Second, I am glad to see that you are all still here. I am having trouble passing a variable through the url, getting it and then determining the correct query with it. For example: $find = $_GET['x']; if ($find = 'y') { sql = "SELECT * FROM table1"; } if ($find = 'z') { sql = "SELECT * FROM table2"; } mysql_query($sql, $connection); When I do this and then change the variable in the url it just takes the information from the first if statement. $find if always equal to "y". Any ideas??
  7. I think I know the answer to this, but am hoping someone can help me. Here is the button code: <form action='writing.php' method='get'><input type='submit' class='sbmt' value='Journalism' name='lnk' /></form> I want the button value to be "Journalism," but I would like it if the text sent in the $_GET request was shortened to four letters, for example 'jour'. I have other links like this one that have spaces in the text and I don't want that in my links. My goal is to have a link that loads a new script and specifies a single four letter variable. I could use $_POST, but thought I would check with the experts and see if anyone had a suggestion that would work given the current set up. Can anyone think of a way to make that happen?
  8. When a user browses through my client's merchandise, they should be able to click on a product image at any time to retrieve a description, details, and larger image(s), of the product. Given the way the site is constructed, it will require a query to the database, and I would like for it to open in a new window so that the shopper does not lose their place. I have a general plan for how to accomplish this. Each product will need a dynamically generated link/submit button. It will open in a new window by using the target='_blank' attribute. I can use either post or get to query the product ID which will allow the new script to query the DB and echo the results to the page. My question is, are there any security risks? This website is generally pretty secure as the only customer input is unsigned integers, and all the get/post requests are validated. Since this is my first cart I just wanted to see if there are any recommended best practices or potential vulnerabilities for which I should plan.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.