Very basic PHP struggles

Question:

I need help to get very simple php to work - apologies for the very basic level of my question!
Repl link:
https://replit.com/@20N7AHCS/WD3-Replit-tutorial#index.php


I believe the code used to work, but now it won’t display the variables. Can someone please explain why? The form is hopefully linked to above. Thanks

<?php $fullname = $_POST["fname"]." ".$_POST["lname"]; ?>
<p>Welcome <?php echo $_POST["fname"].$_POST["lname"];?><p>
<p>Your full name is <?php echo $fullname;?></p>

The link doesn’t seen to work, I recommend following this guide to get the correct repl link :

1 Like

From what I can tell, the code above is correct, are you sure you’re submitting the form correctly? (Fixing that link will help the community figure out what’s wrong.)

Edit: I believe this is the Repl you are referring to.

Edit: Maybe not, however this Repl does do roughly what you are trying to do and does it correctly so you might want to refer to it.

Hi Matthew

Thank you for your support. It’s probably an age thing, but I forgot you had to view as a web page to successfully run the script and that running within Replit always failed. If you could close the enquiry I would appreciate it.

Can I ask a question, even though I know I shouldn’t really be doing this? Is it possible to integrate with an SQLite database from within the PHP area? I am teaching a course that requires this and have not been able to find any links to show whether it is possible.

Thanks

Alan

image001.jpg

1 Like

Hi @adunnet glad you managed to resolve your issue.

In answer to your second question I too have a course which needs SQLite and PHP together (Advanced Higher Computing in Scotland). One solution is to host your SQLite database somewhere outside of Replit that allows external access and then run a Replit PHP server to connect to it.

I’m investigating how to do this in a single Repl though for my day job. I’ll flag this post for follow up and hopefully get back to you soon.

1 Like