1

This might be a weird question, but first let me tell my problem. I have a contact form which is written in php . And after i completed the work, i get to this point that firebase does not support php code. So i need a Solution for that. There are this case that i just hoste my website with another server. Problem here i use dynamic links. So is it possible to use dynamic links with a webpage which is not hosted on firebase?

Solution 2. I rewrite the code . But the in which language? I domt wanna use cloud functions. I wanna use for example javascript. Is this possible?

If you have also any other solution please write them below. Thanks for answering the questions.

this is my code


<section id="page-details">
                <div class="container">
                    <div id="contact-details" class="full-width">
                        <div class="one-third">
                            <div id="contact-us-form" class="grey-corner-box">
                                <form action="contact-from-handler.php" method="post" class="contact-form init" novalidate="novalidate" data-status="init">
                                    <fieldset>
                                        <legend>
                                            <div>
                                                <span class="bold">Drop</span> us a line
                                            </div>

                                            <?php
                                            $contact_name = $contact_email = $contact_website = $contact_message = '';

                                            if(isset($_REQUEST['error']))
                                            {
                                                $contact_name    = $_REQUEST['contact_name'];
                                                $contact_email   = $_REQUEST['contact_email'];
                                                $contact_website = $_REQUEST['contact_website'];
                                                $contact_message = $_REQUEST['contact_message'];
                                            }
                                            ?>

                                            <?php if(isset($_REQUEST['error'])) { ?>
                                                <div style="background:red;color:white;padding:5px;margin:5px 0;clear:both;font-size:14px;">Some required field was missing!</div>
                                            <?php } elseif(isset($_REQUEST['success'])) { ?>
                                                <div style="background:green;color:white;padding:5px;margin:5px 0;clear:both;font-size:14px;">Successfully send your request!</div>
                                            <?php } ?>
                                        </legend>

                                        <ul>
                                            <li class="select-three">
                                                <div>
                                                    <label for="input-name">Name:*</label>
                                                    <input type="text" name="contact_name" value="<?php echo $contact_name; ?>" size="40" class="form-control default-input" aria-invalid="false">
                                                </div>
                                                <div>
                                                    <label for="input-email">E-mail:*</label>
                                                    <input type="email" name="contact_email" value="<?php echo $contact_email; ?>" size="40" class="form-control input-email default-input" aria-invalid="false">
                                                </div>
                                                <div>
                                                    <label for="input-website">Website:*</label>
                                                    <input type="text" name="contact_website" value="<?php echo $contact_website; ?>" size="40" class="form-control default-input" aria-invalid="false">
                                                </div>
                                            </li>
                                            <li>
                                                <div>
                                                    <label for="contact_message">Message:*</label>
                                                    <textarea name="contact_message" cols="40" rows="5" class="form-control textarea form-control" aria-invalid="false"><?php echo $contact_message; ?></textarea>
                                                </div>
                                            </li>
                                            <li>
                                                <div class="submit-contact default-submit">
                                                    <input type="submit" value="Submit" class="submit-btn theme-btn">
                                                </div>
                                            </li>
                                        </ul>
                                    </fieldset>
                                </form>
                            </div>
                        </div>

and then the contact-us-form


<?php
if(isset($_POST) && !empty($_POST))
{
    $data = $_POST;
    $data['email_receiver'] = "emsilll";
    

    $error = FALSE;
    if(!$_POST['contact_name'])
    {
        $error = TRUE;
        $field = 'contact_name';
    }
    elseif(!$_POST['contact_email'])
    {
        $error = TRUE;
        $field = 'contact_email';
    }
    elseif(!$_POST['contact_website'])
    {
        $error = TRUE;
        $field = 'contact_website';
    }
    elseif(!$_POST['contact_message'])
    {
        $error = TRUE;
        $field = 'contact_message';
    }

    if($error)
    {
        header('location:contact-us.php?error=yes&' . http_build_query($data));
        die();
    }

    $to      = $data['email_receiver'];
    $from    = "info@" . $_SERVER['SERVER_NAME'];
    $subject = "Subject: " . $data['contact_name'] . "";
    $message = "E-Mail: " . $data["contact_email"] . "\n" . $message = "Website: " . $data["contact_website"] . "\n" . "Message: " . $data["contact_message"];
    $headers = "From: " . $from . "" . "\r\n" . "Reply-To: " . $from . "" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($to, $subject, $message, $headers);
    
    header('location:contact-us.php?success=yes');
}
?>

2
  • What are dynamic links? Commented Nov 21, 2021 at 23:20
  • @Phil If a user opens a Dynamic Link on iOS or Android, they can be taken directly to the linked content in your native app. If a user opens the same Dynamic Link in a desktop browser, they can be taken to the equivalent content on your website. In addition, Dynamic Links work across app installs: if a user opens a Dynamic Link on iOS or Android and doesn't have your app installed, the user can be prompted to install it; then, after installation, your app starts and can access the link. So sou can create dynamic links only in firebase console. Its a product from firebase. Commented Nov 21, 2021 at 23:22

1 Answer 1

3

Firebase Dynamic Links don't have to be on the same domain as your website. It's common practice to host them on a different domain, or on a subdomain. The actual web forwarding address of the Dynamic link is specifying by the link parameter [1], and doesn't have to be the same as the domain of the Dynamic link.

Firebase provides a free <subdomain>.page.link domain for your usage [2]. You can also setup dynamic links with a custom domain at <subdomain>.yourdomain.com or <subdomain>.yourdomain.com/path[3], which uses Firebase Hosting.

If you would like to switch your entire website over to Firebase Hosting to take advantage of our other features (like the CDN), you can setup your PHP site to run on Cloud Run [4], and setup a rewrite to it using Hosting [5].

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.