Php posting a posted data to another page [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
lets say i have $x data that has posted from another page to my currentpage. and i want to get additional input information from user, and post both of these datas to the next page. how would i do that? i tried to give posted data as a name attribute to button but i cant get them from nextpage
as an example here my current page;
please check it here
here $x came from first page as a posted data. and i will have one more data named="mesai". and i want to access these two in the nextpage. thats why i tried to name button as $x but it didnt work.
hope you understand what i mean. thanks

Use always code format not image for your question.
An option you can use hidden value like:
<input id="howuwant" name="howuwant" type="hidden" value="<?php echo $_POST['howuwant'] ?>">
or if you are in php page
echo " <input id='howuwant' name='howuwant' type='hidden' value='".$_POST['howuwant']."'>;
Now you have all two data for the next page.

Related

Hidden value <p> [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to know how to hidden p value but remain the value in the table. How to do it?
This is the code
<p id="session"></p>
If value in input text field we can hidden the value by using this code hidden="hidden". Value still in the table but user can not see it.
thanks,
faizal.
If it's supposed to be a value in a form (which I presume from your reference to <input>, then you can make it a hidden form field.
<input type="hidden" value="**the value**" id="session" />
However, this will still be visible to a user who looks into the source code of the page. You might find it better to store the value in a session if you don't want the user to know it at all.
you can do like this
<style>
#session {
display:none;
}
</style>
<p id="session"></p>
I'm not sure if i understand the question correctly but you can just put display:none on the P

Php implimentation of Online Examination system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am a newbie PHP devloper and i want to implement an online examination system. I want to implement a system which asks one question at a time i.e after answering 1st question click newxt then 2nd question will be displayed. how to implement this? do i have to implement through sessions? I am using loop but loop displays 20 questions one after another plzz help.
A very easy way to do this would be to implement a html structure that is the same for each questions.
In php, at the beginning of the page, you just check for the post data, if there's none, then you load the first question ( in database, or hardcodded, as you wish ).
If there's post data, you check if the question id is there, save the answer for the user, and load the next question.
It would look a bit like that:
<?php
function loadQuestion($id){
//your logic to load the question
return $question;
}
function saveAnswer($id,$answer){
//your logic to save the answer
}
if($_POST){
saveAnswer($_POST['id_question'],$_POST['answer'])
$data = loadQuestion($_POST['id_question']+1);
}
else $data = loadQuestion(1); //first question
?>
<form method="POST">
<input type="hidden" name="id_question" value="<?php echo $data["id_question"]; ?>" />
<div class="questionDiv">
<?php echo $data["question"]; ?>
</div>
answer:
<input type="text" value="" name="answer" />
<input type="submit" value="send" />
</form>
You could use sessions, yes. Using sessions would allow you to write all of your questions and everything in a single page, and then you could use a switch/case block to pump out the right question within the page. Use the post method on the form, and at the top of your page, check if the post is set, push the data into the correct mysql statement if so, and display the next question question (based on a session variable).

Getting INFO in PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
So, I made a thing where it gets the connection of a game server when you put it in a search box and press submit. Now, what I want it to do is to get the information when I type something like http://link.com/search.php?serverName=hello.com
and that hello.com would be the thing that it gets the information for.
You should consider looking into something called GET which can be added to your HTML form, which essentially adds the content entered into the 'searchbox' onto the URL at the top.
You can try it out using something like this..
<form action="search.php" method="GET">
<!-- Your form components here -->
<input type="submit" value="serverName">
See above that the value of the submit button needs to be set to what you want to appear at the end of the URL, in this case it would display '?serverName'
Then in regards to processing this data, you will need to look up searching algorithms in PHP, the best method is a FULL-TEXT search, but can be quite complicated to do, there are others that will get the job done.
http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
Some more useful links:
http://www.w3schools.com/html/html_forms.asp
http://www.tutorialspoint.com/php/php_get_post.htm

PHP Array of items [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm having multiple images (all which are clickable and have a value associated with each) on a page. Now I want to click any of the images (representing images) and that value is stored in array. So lets say I choose image of drink then meal then extras so everytime I choose one, it is updated in array as element. I am planning to do this in PHP so i was thinking something like PHP self submit? any illustrations are helpful...
Each time I add an item, I need a counter on the same page to increase/increment...
Thanks in advance and appreciated
You'll have to use a very little bit of Javascript there, give the images an onclick-tag with an redirection or bind an event via jQuery. If you're experienced with jQuery use that otherwise use the onlick tag to append the id of your image.
example:
<img src="picture.png" onclick="window.location = 'index.php?meal=1';" />
You have to echo the id's in PHP of course.
You cannot do that only with PHP, as PHP is only executed before the page is shown.. You need to use Javascript and maybe AJAX to update your data on your back end.
Your best option is to add those highlighted items in Javascript and then send it via AJAX to your php handler.

i want to pass a string from one input box to another in different page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i want to pass a string from an input box that after submition automatically goes to different page and the string gets copied in the input box in that page .the Language I am using is php.
In your second page, you need to read the incoming value from the input box and include it in the output (which includes the second input box). Do not forget to pass the value of the variable through htmlspecialchars, since you are outputting it as part of your HTML.
So the code for the second page would look something like this:
$incoming = $_REQUEST['name_of_input_box_1'];
echo '<input type="text" name="name_of_input_box_2" value="'
.htmlspecialchars($incoming).'" />';

Categories