I noted by doing a var_dump($_REQUEST) that the array didn’t include the ‘file_upload’ id which was being checked. As far as I can see from Google (and as the remaining code in the file suggests), PHP moved information about file uploads out of $_REQUEST into $_FILES. So, as a workaround, I moved the line which retrieves the field of interest from $_REQUEST to after the check for whether the field type is ‘file’. A diff between my modified product-form.php and your released one thus looks like:
***************
*** 125,133 ****
foreach ( $all_fields as $fields ) {
foreach ( $fields as $field ) {
$res = true;
- $val = $_REQUEST[ $field["name"] ];
if( $field["type"] != "file" ) {
if( $field["required"] == "yes" ) {
$res = apply_filters( 'wccpf/validate/type='.$field["type"], $val );
}
} else {
--- 125,133 ----
foreach ( $all_fields as $fields ) {
foreach ( $fields as $field ) {
$res = true;
if( $field["type"] != "file" ) {
if( $field["required"] == "yes" ) {
+ $val = $_REQUEST[ $field["name"] ];
$res = apply_filters( 'wccpf/validate/type='.$field["type"], $val );
}
} else {
***************
https://www.ads-software.com/plugins/wc-fields-factory/
]]>Since there seems to be no way to call a class method in the action = part of the form tag, I’ve written a function that uses action = ” so the page will call itself on submit. The method is POST
Here’s the logic:
if($_POST['form_two'] !== 'save_data' ){
global $wpdb ;
//do a query, get some values create a form to
// let the user select one from a dropdown
echo '<form type="post" action="" id="select_one" name "select_one">';
// a foreach to populate and display the <select> element
echo '<input type="hidden" name="form_two" id="form_two" value="save_data"/>';
echo '<input name="send_select" id="send_select" type="submit" value="Select Ad To Edit" />';
echo '</form>';
} else {
// the code for the edit form
}
Fails every time. But change _POST to $_REQUEST and it works perfectly. You get an ungainly URL when you use REQUEST, which seems a bit odd too, but it works great.
I just want to know why $_POST doesn’t get populated but $_REQUEST does. It took me a LONG LONG time to figure out this hack. I’ just like to gain a little knowlege for the effort.
Thanks,
Ed
]]>1 Question
How to get my form input values in same page or in another page template
<form id="formId" action="" method="post">
<input style="width:88%" type="text" name="name">
<input type="submit" name="subs" value="Submit" />
</form>
In same fie i put
<?php
if( isset($_POST['subs']) ) {
echo $_POST['name'];
}
?>
i also tried $_SERVER[‘PHP_SELF’]; in action but its not dsiaplying.
When click submit it refreshed and displays “No Results Found”
2 Question.
How to show the submitted values in wp-admin
]]>I’ve been developing a WordPress site on my local machine and hosting on my own server. Everything runs perfectly.
Since moving to the client server, certain functions in the editor have stopped working. Specifically, those involving ajax requests. I have looked into things and it’s exiting with die(0)
in admin-ajax.php
at the following code:
// Require an action parameter
if ( empty( $_REQUEST['action'] ) )
die( '0' );
further reading sees $_REQUEST
being reset during wp_magic_quotes()
in wp-includes/load.php
as follows:
$_REQUEST = array_merge( $_GET, $_POST );
What might be the issue with the PHP setup on the server that might make $_REQUEST
remain blank after wp_magic_quotes()
during ajax-admin.php
?
If I edit ajax-admin.php
to add the $_REQUEST
reset:
$_REQUEST = array_merge( $_GET, $_POST );
// Require an action parameter
if ( empty( $_REQUEST['action'] ) )
die( '0' );
…then everything ajax in the editor works as it should.
But I would rather not edit core files, so would like to know how I can change the server setup to get things working with the standard files?
Any help appreciated.
Thanks,
matt
if( !isset($_REQUEST['sorting'])) {
$_REQUEST['sorting'] = "views";
}
However, if I include this code, then if there are no matches, it still displays all of the results for that category. If I remove this code, the search results display correctly. How can I set the default view without destroying the search results? And why does this code affect it??
Thanks!
]]>In my comments.php I inserted a form :
<form name="myForm" action="" method="GET" style="float:right" >
<SELECT NAME="format">
<OPTION>Test 1
<OPTION>Test 2
</SELECT>
<SELECT NAME="ordre">
<OPTION>Example 1
<OPTION>Example 2
</SELECT>
<input type="submit" name="submit" value="Trier">
</form>
I want to store the selected value in a cookie, so I added this function to my functions.php :
<?php
function set_navi_cookie() {
$sc_ordre = $_REQUEST[‘ordre’];
setcookie(‘naviga’,$sc_ordre,time()+60, COOKIEPATH, COOKIE_DOMAIN, false);
}
add_action( ‘init’, ‘set_navi_cookie’);
?>
but $sc_ordre is null. I tried $_REQUEST[‘ordre’]; but it’s always null.
What I did wrong ?
]]><<?php
//print_r($_REQUEST);
$ID_Code = get_post_custom_values('ID_Code', $_REQUEST['WP_ID']);
;
$body = "\n\nName: ".$_REQUEST['contactname'];
$body .= "\n\nE-mail: ".$_REQUEST['contactemail'];
$body .= "\n\nPhone#: ".$_REQUEST['contactphone'];
$body .= "\n\nCustomer Type: ".$_REQUEST['cust_type'];
$body .= "\n\nComments: ".$_REQUEST['contactcomments'];
$body .= "\n\nID_Code: ".$ID_Code[0];
$body .= "\n\nAd Body: ".strip_tags(get_post($_REQUEST['WP_ID'])->post_content);
$body .= "\nAd Link: ".get_permalink($_REQUEST['WP_ID']);
$client_tag= <<<t
Thank you for contacting. We appreciate your business and will respond personally to your inquiry.
-------
t;
$my_post = array(
'post_author' => 3,
'post_category' => array(5),
'post_content' => $_REQUEST['contactcomments'],
'post_status' => 'draft',
'post_title' => $_REQUEST['contactcomments']
);
$post_id=wp_insert_post( $my_post );
//Set things to EST, in case we're not already there.
date_default_timezone_set('EST');
if ($_REQUEST['cust_type'] == 'Reseller'){
$isreseller = 'c';
}
$a_code = date('md').substr(date('a'), 0, 1).substr(date('a'), 0, 1).$isreseller.date('hi');
if( !is_wp_error($post_id) && $post_id > 0 ) {
add_post_meta($post_id, 'Contact_Email', $_REQUEST['contactemail']);
add_post_meta($post_id, 'Contact_Name', $_REQUEST['contactname']);
add_post_meta($post_id, 'Contact_Phone', $_REQUEST['contactphone']);
add_post_meta($post_id, 'Contact_Customer_Type', $_REQUEST['cust_type']);
add_post_meta($post_id, 'ID_Code', $a_code);
}
$elink = "\n\n Edit Link: https://www.somedomain.com/wp-admin/post.php?post=$post_id&action=edit \n\n\n";
//$editlink = "\n\nResponse ID_Code:" .$_REQUEST['a_code'];
$headers = 'From: [email protected]'."\r\n" .
'Reply-To:' . $_REQUEST['contactemail'] ."\r\n";
$subject= 'Ad Response:' .strip_tags(get_post($_REQUEST['WP_ID'])->post_title)."\r\n";
if ($_REQUEST['contactemail']){
mail('someone@@somedomain.com', $subject, $elink.$body,$headers);
//mail($_REQUEST['contactemail'], 'Response to somedomain.com Ad', $client_tag.$body, $headers);
// mail('[email protected]', 'Response to somedomain.com Ad', $body.$editlink, 'From: [email protected]');
mail($_REQUEST['contactemail'], 'Response to somedomain.com Ad', $client_tag.$body, 'From: [email protected]');
}else{
echo'<h2>You seem to have entered an invalid e-mail address. Please try again.';
}
?>
]]>Developing my first plugin, I have run into some problems. My plugin is displayed on a standard page. On this page, I have an index with links for every letter in the alphabet. When the user clicks a link, I want to display all records from the database that has a name that starts with the selected letter. However, I can’t catch the GET vars. My links look like this:
<a href="?action=index<r=A">A</a>
The function where I handle the links looks like this:
if ( isset( $_REQUEST['action'] ) ) {
switch( $_REQUEST['action'] ) {
case 'search' :
$output .= do_search();
break;
case 'index' :
$output .= show_index();
break;
}
}
The search action works fine when I submit the search form (action=post), but the show_index() function does not get called when i click on the link above.
I’m fairly new with both php and wordpress, so I’m probably just doing something wrong, but I can’t figure out what.
Any suggestions will be appreceated.
/Rasmus
]]>$wp_query->query_vars
but I’ve run into a wall.
GPC magic quotes is disabled, and I can find properly UNescaped values in my $_GET
outside the WordPress context. But within the WP context, things go wonky.
All my $wp_query->query_vars
are escaped, as are the $_GET
values, but not $_REQUEST. That is, $_GET['var'] == \"quotedstring\"
but $_REQUEST['var'] == "quotedstring"
I really need UNescaped query values. I’m doing an array_map(‘stripslashes’, $wp_query->query_vars), but is there a way to get the values before they get slashed up?
Tips, suggestions, help?
]]>