Note that there are some explanatory texts on larger screens.

plurals
  1. POTwo PHP Forms that Redirect to x/y URL on the same page
    primarykey
    data
    text
    <p>I am trying to create a 'simple' redirect for clients who use either Wordpress or Indexhibit to manage there sites. </p> <p>I have set it up to allow them to input their domain and have it redirect to the respective Admin areas (<em>I am amazed at how many people forget but hey ho this is my solution</em>)</p> <p>I got it working fine for a single redirect but off the back of a previous SO submission tried to integrate both using if / elseif and it fails to Parse.</p> <p>Any ideas what I have done wrong / help much appreciated!</p> <pre><code>&lt;?php if ($_POST['indexhibit_url']) { if($_SERVER['REQUEST_METHOD'] == 'POST') : $indexhibit_url = $_POST['indexhibit_url']; header('Location: http://' . $indexhibit_url . '/ndxz-studio/'); } elseif ($_POST['wordpress_url']) { if($_SERVER['REQUEST_METHOD'] == 'POST') : $wordpress_url = $_POST['wordpress_url']; header('Location: http://' . $wordpress_url . '/wp-admin/'); } ?&gt; &lt;form action="&lt;?php echo $_SERVER['../PHP_SELF']; ?&gt;" method="post" name="indexhibit_url"&gt; &lt;h3&gt;Indexhibit&lt;/h3&gt; &lt;p class='formp'&gt;If your website is powered by &lt;em&gt;Indexhibit&lt;/em&gt; submit your URL to be forwarded to your admin area&lt;/p&gt; &lt;input class='loginforms' type="text" value='i.e. your-domain-name.com' onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'i.e. your-domain-name.com':this.value;" name="indexhibit_url" /&gt; &lt;input class="btn btn-info loginbuttons" name="index_submit" type="submit" value="Go" /&gt; &lt;/form&gt; &lt;form action="&lt;?php echo $_SERVER['../PHP_SELF']; ?&gt;" method="post" name="wordpress_url"&gt; &lt;h3 style='margin-top:2em;'&gt;Wordpress&lt;/h3&gt; &lt;p class='formp'&gt;If your website is powered by &lt;em&gt;Wordpress&lt;/em&gt; submit your URL to be forwarded to your admin area&lt;/p&gt; &lt;input class='loginforms' type="text" value='i.e. your-domain-name.com' onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?'i.e. your-domain-name.com':this.value;" name="wordpress_url" /&gt; &lt;input class="btn btn-info loginbuttons" name="wp_submit" type="submit" value="Go" /&gt; &lt;/form&gt; &lt;?php endif; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload