Send URL with variables in PHP

Asked

Viewed 722 times

0

I am trying to submit a URL that has variables that will be treated on another site.

I have the code:

<form action="OUTROSITE.COM/default.aspx?q=1136&lang=pt-PT&CheckIn=<?php echo $_REQUEST['dpd1'];?>&CheckOut=<?php $_REQUEST['dpd2'];?>&ad=<?php echo $_REQUEST['electAdults'];?>" method="POST" target="_blank">

And HTML like this:

                <input type="text" value="" id="dpd1" readonly placeholder="Check-in"/>
                <input type="text" value="" id="dpd2" readonly placeholder="Check-out" />
                <select id="selectAdults">
                    <option selected><?php echo $lang['BE_ADULTO']; ?></option>
                    <option value="1" >1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                </select>

                <select id="childs">
                    <option selected><?php echo $lang['BE_CRIANCA']; ?></option>
                    <option value="1">0</option>
                    <option value="2">1</option>
                    <option value="3">2</option>
                    <option value="4">3</option>
                    <option value="4">4</option>
                </select>
                <input type="text" placeholder="<?php echo $lang['BE_COD_PROMOCIONAL']; ?>"/>
                <input type="submit" value="Enviar">

When I submit, the open link is:

OUTROSITE.COM/default.aspx?q=1136&lang=pt-PT&CheckIn=&CheckOut=&ad=&sid

Variables do not follow the link, how can I send the link with variables?

  • Forgot a echo in $_REQUEST['dpd2'].

  • Hello @Thomas fixed, but still does not work, URL will empty

  • If dpd1 and dpd2 sane readonly and start without value, as the values of these variables arrive in the $_REQUEST?

  • is a datepicker from Foundation http://foundation-datepicker.peterbeno.com/example.html, I have readonly the user cannot change.

  • Have you tried removing the readonly?

1 answer

3


Try this:

<select id="selectAdults" name="selectAdults">

<select id="childs" name="childs">

If it doesn’t work, you can always change the $_REQUEST['dpd1'] for $_GET['dpd1'] or $_POST['dpd1']

  • really that was it, missing the name="". Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.