0

im trying to call a php function in submiting a form.

here my full php file: ( am i write correct? )

<?php
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
?>
    <div class="manual_sending_form" id="manual_sending_form">

        <div class="inside">
            <form class="initial-form" id="manual_sending" method="post" name="post"
                  action="<?php echo admin_url( 'admin.php?page=my-page' ) ?>">

                <p>
                    <label for="resive_number">My Field</label><br>
                    <input type="text" name="resive_number" id="resive_number"
                           value="<?php echo isset( $_POST['sms_numbers'] ) ? sanitize_text_field( $_POST['sms_numbers'] ) : '' ?>"
                </p>


                <p>
                    <input type="submit" class="button button-primary" name="send_sms_button"
                           value="Send">
                </p>
            </form>
         </div>
    </div>


<?php
if ( isset( $_POST['send_sms_button'] ) ) {
    try
    {
        $phone = $_POST['sms_numbers'];

// do some code hwre
?>

did i correct on below line? i just want to input something there ( i need this value on function.

 value="<?php echo isset( $_POST['sms_numbers'] ) ? sanitize_text_field( $_POST['sms_numbers'] ) : '' ?>"

or this part is correct ? ( $phone = $_POST['sms_numbers']; )

i dont know why i get below error, //// Notice: Undefined index: sms_numbers in

1
  • 1
    the form input name is resive_number not sms_numbers Commented Apr 26, 2018 at 23:47

1 Answer 1

1

Try to replace your code into this

<input type="text" name="sms_numbers" // change input name to sms_numbers

and set this line at the top of your page

ini_set('display_errors',0);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.