Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
So I'm working on a form that takes a link and outputs to a page with a custom made header by me.(similar to StumbleUpon)
What I'm having trouble with is being able to share that page on facebook or other social media. Because currently it has the same link no matter what page it is.(the link is the page I have the form action as).
I want the outputted page to be have "sharable" link. Like when I paste the link of that page on facebook, it generates thumbnails, a short description,etc.
Well, basically, the process should be something along the lines:
1. Take input from the form (presumabli input type=text name=url)
2. Save that $_POST[url] to the database, and assign unique identifier to it (id, hash, uuid, ...)
3. Redirect user to visit.php?hash=assigned_hash which will display the saved page based on the hash from the database
That is one approach (better in my opinion). Another approach is, change form method to GET, so you will get link
http://yoursite/url.php?url=http...
Which can then be copied and pasted, but also enables users to see the link and possibly alter it and what else.
Let me know what you think
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I would like to set up user system in Wordpress, which is not limited to writing post or comment. Instead I would like to store custom user data (in my case users are tutors) for example the subject they teach and the price they charge. How could i do it with PHP or Sql?
You have two options here:
A) modify the registration form/process and request the users/tutors to input additional data when they register on the site; this will also require you to provide them with a user friendly interface screen where they can update/edit their information. What I usually do is create a view to display the user's info on the front end and then when loading that page check if the user is viewing their own profile and if so, load additional edit options in line with their data - I then use AJAX to allow them to update their own info.
B) if you want to manually manage this info yourself then simply have the users/tutors fill out a form and then you can update/edit a custom post-type called sevenine-tutor that you'll have to register/create in the system.
In theory you'd want these users managing their own profiles so option A) is probably the right route to pursue.
Questions like this are hard to answer because they're purely theoretical so there could be numerous ways to tackle them and whether an answer is correct or not is purely subjective. My advice would be to break your idea up into chunks and try tackling functions one by one and if you get stuck on something, then post relevant code here or to wordpress.stackexchange.com and get answers to very specific technical questions.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I want to know if it is possible with PHP to make action only happen once.
I have a script where users click an image and gain points for clicking it, but I would like to make it so that if they click again it won't add points anymore for a certain amount of time, or an advertisement would disappear from the site for that particular user.
Is this possible?
Store it in the database.
When they click on the image, run a query that changes the is_clicked column (for instance) to clicked or 1 or whatever you like.
Retrieve the image in such a way that, if the is_clicked column is changed to clicked for a particular user, then don't allow any clicks.
For example :
if($row['is_clicked'] != 'clicked']){
echo '<img>....</img>';
}
It is possible but with PHP, it can get pretty messy. I would suggest you use JS (Javascript). Create a simple function in JS and then use the onclick attribute in the the button element to execute. Like this:-
<script>
document.getElementById('id of the button').onclick='myFunc';
function myfunc(){
document.getElementById('id of the button').style.display="block";
}
</script>
Front end, html:
<button id="id of the button">Click here!</button>
Now if you want to make sure a person who clicks button from a computer shouldn't be able to click it again, then you should set up a cookie using php which will retrieve data about its computer and prevent the computer from using this button
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want $counter=$counter +1, when this link on my website is clicked:
<img src="images/old.jpg" width="190" height="32" />
I've tried $counter++; in several creative ways, none of which seem to have worked.
PHP is a server-side language.
This means that PHP is (most often) only responsible from
When the server receives a request
until
The PHP program outputs the page.
So if you want something to happen in response to your action AFTER the page is loaded (e.g. clicking a link), PHP cannot handle that.
Now, you should choose your implementation in either Javascript or PHP depending on what you want to achieve.
If you want to store the counter value in your server, and increment it:
Set the destination of the link to the exactly same page as the one you are viewing now. Use $_SESSION to store a value, and it will be stored across multiple requests.
If you want to see the value of the counter go up as you click on the link:
Use Javascript to store the counter as an variable, and increment it on each click. This will be reset if you refresh the page.
Note: You cannot achieve neither of this if your link takes you to another page. That becomes a whole new story.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is something I need help on.
Im going to allow a user from my database to "share" a record which gets sent from the database into a solid html file.
So I'm looking at ways to create a html file from data in a database which is passed through php and stored in a location on the server. with no interaction from the user at all other than pressing 'share'. They would be sent the url to look at it upon success.
I'm looking for any functions or tuts on how to best make a html file from php. any help is appreciated. I think I may be looking into this too much, and the answer may be staring me in the face
As it got clear, you want static html files, created dynamically via PHP and written on the server.
The steps you need to follow are clear too:
You need the database and as you said you have it
You need to connect to it via PHP
Then do the respective queries
Fetch the data from them
Use it in the HTML
Open a file
Send the used data to it
Write the file with the relevant name
The querying should start after the button share is clicked (you can track this via isset() function)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Okay, bear with me. Part of my job is filling out online forms for customers who call in. In these forms there are all kinds of useful information that is hidden in input tags. I would like to make my own page that would extract and display all this useful information. I would also use this page to count the number of times I submit the form throughout the day.
The way I currently have it set up it is in a frameset. The left frame has links to the different forms we fill out, and when I click on one the external form is populated in the right frame. Javascript would be perfect for the job except that my frame is not located on the same server as the forms.
I stink at PHP. Not gonna lie. So i'm not looking for any hand-outs but any pointers would be great.
For example you may check out the forms on http://www.youcangetacar.com and you may use the pin code "A101" or you can check out what I have so far at http://customertrack.host-ed.me/
Make a page that cURL’s the page that is passed to it via url(curl.php?url=http://www.google.com) and then you dont have trouble with same domain policy.
Don’t forget to string replace relative urls with absolute urls.
eg, action="/submit/form.php" must become action="http://www.domain.com/submit/form.php"