I'm looking to modify the pagination in Magento in an order to give user an opportunity to switch to any page at any moment. To my mind it can be a text field, when somebody enters page number x, it will redirect to http://www.domainname.com/catalogpage.html?p=x
Any ideas of this php line?
<form action="catalogpage.html" method="post">
<input type="text" name="p">
<input type="submit">
</form>
Works?
Related
This is simplified code of index.php :
<form action="index.php" method="get">
<input type="text" name="course">
<button>Find</button>
</form>
Suppose, in the text field "ADAM" is put and after pressing Find button url becomes
myweburl/index.php?course=ADAM
But I want to make it
myweburl/index.php?course=ADAM#courseid
NB: Here courseid is a div id name inside index.php. By this way, I will be able to scroll down the result area.
Do you know how to do this?
Why not do it in a more legitimate way
<form action="index.php" method="get">
<input type="text" name="course">
<input type="hidden" name="courseid" value="<?php echo $courseId;?>">
<button>Find</button>
</form>
Then you get a url like this
myweburl/index.php?course=ADAM&courseid=1234
Now you dont have to do any text manipulation in the script that processes the data you just use
$_GET['course']
$_GET['courseid']
Simply add the hashtag to the action attribute.
The browser would know to move it to the end of the url string (after the GET parameters).
<form action="index.php#courseID" method="get">
<input type="text" name="course">
<button>Find</button>
</form>
Would result:
index.php?course=xxxx#bla
Tested on Chrome, if someone find other results please update.
so I have been building a small website with a content management system I have built using PHP and mysql. What I am trying to achieve is the user needs to be able to edit and delete the announcement posts they make, so I have been using $_GET to get the ID of the post that is to be edited/ deleted and chucked into a form which holds the code to do that.
Now, this is the code I have been using
if(isset($_GET['edit'])) {
header('Location: announcement-edit.php?AnnouncementID='.$_GET['AnnouncementID']);
}
The form later down the page to execute this is as follows
<form action="announcements.php" method="get">
<input type="hidden" name="AnnouncementID" value="<?php echo $row['AnnouncementID'];?>" />
<input name="edit" value="Modify" type="submit">
<input name="delete" value="Delete" type="submit" >
</form>
This is where it confuses me, this code worked absolutely perfectly then all of a sudden last week it stopped, 2 days ago it started working again and now broken again. When the button is clicked the URL returns as;
url/folder/announcements.php?AnnouncementID=7&edit=Modify
When its supposed to return;
url/folder/announcement-edit.php?AnnouncementID=7
If i manually type the above in the url bar it works absolutely fine and I can update the rows in the DB.
Im totally stumped as to why it is so temperamental, Have I missed something out? am I trying to do this an out dated way?
Its not like I have just followed a random person on youtube how to do this I was actually shown this way at university (only last academic year) and we was told it was "good practice". Seems very weird it works perfectly one minute then refuses to work the next.
Any thoughts or suggestions will be greatly appreciated.
You have two submit buttons in your form, which leads to triggering the submit event only once, when you press Enter key. So, when the Delete button is pressed, your GET parameters will have only delete entry and not the edit entry.
One way of tackling this is, give the same name to both and give a different value, as already there is a different value.
<form action="announcements.php" method="get">
<input type="hidden" name="AnnouncementID" value="<?php echo $row['AnnouncementID'];?>" />
<input name="action" value="Modify" type="submit" />
<input name="action" value="Delete" type="submit" />
</form>
You dont need to use form. You can do it simply using url and use tag
Try to pass your parametr via get parametr like this:
Edit
Delete
I'm working on building a more user-friendly frontend access page in Wordpress for a content library built on ContentDM (http://www.oclc.org/support/questions/contentdm/default.htm). One of the things that was requested as part of the site was a search form that instead of searching Wordpress, goes to the ContentDM library and searches there.
It appears that the search syntax for ContentDM is as follows:
http://libraryID.contentdm.oclc.org/cdm/search/searchterm/INPUT_TERM/order/nosort
With "INPUT_TERM" being whatever the user searched for.
In other words, in order to create a search form that went directly there, I'd have to dynamically insert the contents of the input element into the middle of the "action" attribute of the form.
I'm guessing my best bet is to just send it to a PHP page that sticks $_POST['whatever'] into the URL and does a redirect. But is there in fact a way to do it dynamically from the form (ideally without Javascript) and save a step?
Thanks!
I guess something like this could work:
<form action="" method="get"
onSubmit="location.href='http://libraryID........./'+this.children[0].value+'/order/nosort; return false;">
Search: <input type="search" />
<input type="submit" value="Go" />
</form>
This will redirect the browser to the search page given in the search box, however it's not terribly reliable.
You might want to see if there's a query string "version" of the URL - maybe that search URL is affected by mod_rewrite to "look pretty", and you might be able to have http://libraryID.contentdm.oclc.org/cdm/search as the action, and have the input field named searchterm:
<form action="http://libraryID.contentdm.oclc.org/cdm/search" method="get">
Search: <input type="search" name="searchterm" />
<input type="submit" value="Go" />
</form>
I have a form like below on my index page:
<form action="send.php" method="POST">
<b>Your name :</b> <input type="text" name="name"><br>
<b>Your e-mail :</b> <input type="text" name="email"><br>
<b>Message</b><br><textarea name="message"></textarea>
<input type="submit" value="Send">
</form>
When I click the submit button, it posts the values on the index form still instead of navigating to send.php
/index.php?name=chris&email=heymega%40gmail.com&message=HELLO!
Notice how its still on the index page. Any ideas why this is happening?
Both files exist in the root directory.
Either you already have another form tag open that you haven't closed earlier on the page, or it's not liking that you have POST in uppercase - I believe it should be lowercase.
Ok really taking a shot in the dark here since you said that it isnt nested in anyother forms and that it "still" sends to index.php that you need to press ctrl+F5 to refresh the possibly cached version of this page.
If that doesn't work then post your complete html code with the javascript.
I would like to make a button on my website that automatically logs me in on another website. I recon I can use either Javascript/jQuery or PHP/cURL to do this.
Which is the best way to go?
You may use either remote javascript or iFrame. Find more details here: http://kuza55.blogspot.com/2007/06/building-secure-single-sign-on-systems.html
Also checkout google's approach named SAML: http://code.google.com/googleapps/domain/sso/saml_reference_implementation.html
It depends what the website is. JavaScript and jQuery alone cannot be used due to the cross-domain policy. You could perhaps use a combination of cURL and AJAX to achieve something similar.
I think you might need to provide a little more information about the site, and exactly why you'd want to do this...
I'm not sure if this is exactly what you're looking for, but one thing I have done in the past is to mimic the login form on the site you want to log in to.
For example lets say you want to log in to 'example.com'. In the source code for the login page of 'example.com' you will find the html code for the login form.
Example
<form name="blabla" action="action.php" method="post">
<input type="text" name="username" />
<input type="password" name="password" />
<input type="sumbit" value="Login" />
</form>
Create a form on your site similar to the one you find in 'example.com'. If you want you can even hide the fields, include values to make it a one button login. The trick is making sure that the action has the actual url. For example if the form says 'action.php' for 'example.com' you would put 'http://example.com/action.php'
Example
<form name="blabla" action="http://example.com/action.php" method="post">
<input type="hidden" name="username" value="testuser" />
<input type="hidden" name="password" value="testpass" />
<input type="sumbit" value="Login" />
<form>
This will log you in to the site in most cases. If you don't want to leave your own site you can set a 'target' for the form to an iframe or something.