[Flash] how to hode from view page source

Hello All,

I have a list of questions stored in question.php.
On one of my page called my questions.php i am calling it by <?php include_once(“question.php”); ?>
The problem is that, on viewing questions.php in browser, when i view page source, it displays all the questions there. Is there any way by which this list can be hide from view page source?


It sounds to me as if your server isn’t set up correctly, though it depends on the contents of ‘question.php’. If it’s working right, the server should open question.php and run it, and the only stuff visible in your browser will be the output from the php code on that page, and the page that included it.

I’m not 100% on this as I’m learning, but it was one of the first thing that puzzled me, how come a site user can’t just look at the code that I use to open my database? And that’s because the php is never delivered to the browser, only the result of the echo() statements.

Can you show us the contents of ‘question.php’?

Hello, i messed up with the names of php files below… here again is my question. i have questions stored in asks.php. i call that file in question.php using php as shown below in code. browser shows the right output but when i right click and go to view source code it shows all the questions stored in ask.php.



$question=preg_replace('#[^a-z0-9 ]#', '', $_POST['sques']);
$answer=preg_replace('#[^a-z0-9 ]#', '', $_POST['sans']);;
if($question="" || $answer="")
{ echo "Both the field are necessary and cannot be blank";
  $sql= "INSERT INTO useroptions (question,answer) VALUES('$question','$answer')";

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<form method="post">
<label>Chooser your security question</label>
<select name="sques">
      <?php include_once("asks.php"); ?>
</select><br />
<label>Input your security answer</label>
<input type="text" name="sans" placeholder="Only alphabets" required="required" /><br />
<input type="submit" value="Update" name="submit" />
<input type="reset" value="Reset" name="reset" />


<option value=""></option>
<option value=“Which is your favourite sport”>Which is your favourite sport</option>
<option value=“Name of your first School”>Name of your first School</option>
<option value=“My dream Honeymoon place is”>My dream place is</option>
<option value=“The first movie i watched”>The first watch you had,was of which company</option

Well, that isn’t PHP, it’s HTML, which is why it’s displaying. Just because you’ve called it asks.php doesn’t matter. Why does it matter if it appears when they right-click and view code, as it’ll be on the screen anyway in the drop-down list?

it will be on drop-down… actually it was on my mind from a long time that if i am calling it in <?php ?>,then why it is appearing on the source. I am in learning phase and want to clear these types of doubts by getting answers from the master ones. :slight_smile:

Can you provide the current output you see in view source and then in a separate code block what you want to see when you view source?

I’m not sure I understand what you are asking.

my basic question was is there any way by which we can hide the data called in between <?php ?> tags from other file. for above question droopsnot has solved my query.

basically i want to develop a system which shows you a question on the screen with answer options below it. below there will be two options next or skip. when you press any of them, a new question will get displayed on screen. i want to achieve this, i havens done this before so i don’t have the idea for this.

At this point, i only know that those questions can be stored in database. But i dont know how to call them on user screen and implement the above system. i also want that these questions come randomly from the database. and the questions which are answered by a user,will get stored in his database part. so that he can see it later too.

To make sure I understand you.

You have a set of Questions and Answers.
Your dilemma is on how to output only as much as needed without having view-source reveal content that could negate the intent of the rendered page?

PHP gets processed on the server, and sends some HTML to the browser. So if you don’t want all the questions sent to the browser, you’ll have to change how the PHP works.

If you send everything at once it will be visible
If you send one-at-a-time from PHP it would mean more HTTP requests.

If you can code to limit AJAX from what to load into the DOM it could work to reduce the HTTP requests from the users perspective.
Though AFAIK “back button” would likely be a problem.

i can manage if one question is displayed at a time and source code is showing it only.please visit , you can understand from there what exactly i want. i want my questions also to come like that one by one. http://www.aptitude-test.com/general-aptitudetest1.html

That’s in flash, not PHP you’ll need to decide what you want to do and how you want to do it.
(the “one by one” or the “lke that”)

i want to do it like in the url. I haven’t done it before, i want idea for to start

We know that but what all that’s have been said above is still valid.

That website you’re linking to uses Flash. I’d presonally wouldn’t go that route but that’s what they use… so do you want to use flash or not?

Because your code is not flash. It is just HTML, CSS and PHP.

Still, what they do in that page is showing one question per page. It is an aptitude test.

Your goal is completely different. You want to show a set of questions so the user chooses one and then answers it.

Personally, I would simply add the <option> to the <select> and I wouldn’t bother about trying to hide those texts… Yes, from a security point of view, it would be safer that they were not visible in the code but the only way to do it is using third parties propietary software, like Flash but that causes more problems that it solves.