Tengo dos formularios iguales con distinta Id. Los dos realizan la misma funcion pero se llaman desde botones diferentes mediante un Onclick.
Un formularo tiene id="formbox" y el otro tiene id="formboxpay"
Bien me gustaria saber si es posible meter como condicion el "Id" de un formulario en un IF. Nose si me explico.
El IF:
Cita:
Necesito meter una condicion al segundo if, para que se active cuando "activate_paypal ==yes y cuando este (o tenga seleccionado) el formulario con id:"formboxpay".if ($ok == "ok") {
echo "<div class=\"ok\">";
echo "Sus datos se han enviado correctamente<br />";
if ( get_option('activate_paypal') == "yes") {
$post_id = (int)$_GET['id'];
$post_title = $_GET['title'];
$post_title = str_replace("+", " ", $post_title);
?>
echo "<div class=\"ok\">";
echo "Sus datos se han enviado correctamente<br />";
if ( get_option('activate_paypal') == "yes") {
$post_id = (int)$_GET['id'];
$post_title = $_GET['title'];
$post_title = str_replace("+", " ", $post_title);
?>
Igual estoy diciendo una burrada, no tengo mucha idea sobre codigo, pero creo que es lo que necesito para que funcione bien.
>Tanto Los formualrios como los If se encuentran dentro del mismo archivo .php.
Os dejo el codigo del formulario con id: "formboxpay"
Código:
Un saludo y gracias! <div class="classform" id="formboxpay" <?php if ($err == "") { echo "style=\"display: none;\""; } ?>> <form action="" method="post" enctype="multipart/form-data" id="new_post2" name="new_post2"> <input type="hidden" name="action" value="post" /> <?php wp_nonce_field( 'new-post' ); ?> <div class="left_form"> <label for="title">Titulo: <span>*</span></label> <input type="text" id="title" name="post_title" value="<?php echo $post_title;?>" /> <label for="cat">Categoria: <span>*</span></label> <?php wp_dropdown_categories('show_option_none=Selecciona categoria&orderby=order&order=ASC&hide_empty=0&hierarchical=1'); ?> <label for="phone">Telefono: </label> <input type="text" id="phone" name="phone" value="<?php echo $phone; ?>" /> <label for="price">Precio: <span>* <small><em></em></small></span></label> <input type="text" id="price" name="price" value="<?php echo $price; ?>" /> <label for="location">Localidad: <span>*</span></label> <input type="text" id="location" name="location" value="<?php echo $location; ?>" /> <label for="name_ad">Tu nombre: <span>*</span></label> <input type="text" id="name_ad" name="name_ad" value="<?php echo $name_ad; ?>" /> <label for="email">Email: <span>*</span></label> <input type="text" id="email" name="email" value="<?php echo $email; ?>" /> <label for="description">Descripcion del articulo: <span>*</span></label> <textarea name="description" id="description" rows="10" cols="93" onkeydown="textCounter(document.new_post2.description,document.new_post2.remLen1,1000)" onkeyup="textCounter(document.new_post2.description,document.new_post2.remLen1,1000)"><?php echo $description; ?></textarea><br /> <div class="limit"> <input readonly="readonly" type="text" name="remLen1" size="4" maxlength="4" value="1000" style="width: 50px;" /><span style="font-size:11px;"> caracteres restantes</span> </div> <center> </center> </div> <div class="right_form"> <img src="<?php bloginfo( 'template_url' ); ?>/images/add-images.jpg" alt="Añadir imagenes" /><br /> <input type="file" name="images[]" class="wwIconified" /><br /> <small>(las imagenes deberan ser menores de 1MB o no seran validas)</small> <img src="<?php bloginfo( 'template_url' ); ?>/images/more-contact-information.jpg" alt="mas informacion de contacto" style="margin-top: 40px;" /><br /> <label for="yahoo">Yahoo: </label> <input type="text" id="yahoo" name="yahoo" value="<?php echo $yahoo; ?>" /> <label for="aim">Aim: </label> <input type="text" id="aim" name="aim" value="<?php echo $aim; ?>" /> <label for="msn">MSN: </label> <input type="text" id="msn" name="msn" value="<?php echo $msn; ?>" /> <label for="gtalk">Gtalk: </label> <input type="text" id="gtalk" name="gtalk" value="<?php echo $gtalk; ?>" /> <label for="skype">Skype: </label> <input type="text" id="skype" name="skype" value="<?php echo $skype; ?>" /><br /> </div> <div style="clear: both; height: 20px;"></div> <center> <div class="capcha"> <?php $nr1 = rand("0", "9"); $nr2 = rand("0", "9"); ?> <?php echo $nr1; ?> + <?php echo $nr2; ?> = <input type="text" name="total" style="width: 30px; text-align: center; border: 1px #DF0005 solid; padding: 4px;" maxlength="2" value="" /> <input type="hidden" name="nr1" value="892347<?php echo $nr1; ?>" /> <input type="hidden" name="nr2" value="234543<?php echo $nr2; ?>" /> </div> <input id="submit" type="submit" value="Insertar anuncio!" class="postit" /> </center> </form> </div> <!-- // postbox -->