how to call variable in next page
Am getting Notice: Undefined index: getdobcval in C:\xampp\htdocs\bgtest\buy_test.php on line 11
Am trying call variable, how to call variable from page1.php to page2.php
am using below form action
<form action="" method="POST">
<input type="text" name="getdobcval">
<input type="submit">
</form>
when user click submit value, it'l store the value in database and show the values in same page, i used page redirectory option after function finish (after 5 seconds). page redirectory working but after page am getting error
how to call <input type="text" name="getdobcval">
value ?
this is my database
if(isset($_POST['submit'])){
$getdob_cval = $_POST['getdobtcval'];
$conn = mysqli_connect("localhost", "root", "", "bgtest");
$sql = "INSERT INTO bgtest(getdobtcval) VALUES('$getdob_cval')";
if (mysqli_query($conn, $sql)){
echo "Please wait, We are redirecting another page!";
echo '<script> setTimeout(function(){
window.location.href="buy_test.php"
},3000);
</script>';
}else{
echo "error";
}
mysqli_close($conn);
}
1 answer
-
answered 2017-06-17 18:14
InfiniteStack
This is usually done via a server-side script. Let's say script.php
<form action = "script.php"...
Or make sure that
<form action = ""...
Is specified in from on a .PHP page itself.
When the script refreshes, the values will be available via following array:
<?php $a = $_POST["getdobcval"]; // Submitted as POST $b = $_GET["getdobcval"]; // Submitted as GET ?>
Or alternatively you can receive it regardless of how it was submitted by:
<?php $c = $_REQUEST["getdobcval"]; ?>
See also questions close to this topic
-
Table not populating correctly PHP HTML MYSQL
I am trying to add records from my database to a table as a list of links that takes the user to a more details page about vendors they can view. But only the first record is being put in the table where as the rest are appearing as a jumbled up mess outside the table at the bottom of it.
Can anyone see what I've done wrong with my table echos?
<?php session_start(); $link = mysqli_connect("localhost", "root", "root") or die(mysqli_error($db)); mysqli_select_db($link, "keepers") or die(mysqli_error($link)); // Check connection if($link === false) { die("ERROR: Could not connect. " . mysqli_connect_error()); } ?> <html> <head> <title>Beekeeper</title> <meta name="author" content="Nigel Kennington"> <meta name="description" content="Find local honey near you"> <meta name="keywords" content="honey, bees, bee, local"> <link href="bees.css" type="text/css" rel="stylesheet"> </head> <body> <div id="linkbar"> <table height="140px" ID="Table1"> <tr> <td valign="bottom"><a href="index.php">Home</a> |</td> <td valign="bottom"><a href="about.html">About</a> |</td> <td valign="bottom"><a href="contact.html">Contact</a></td> </tr> </table> </div> <div id="bulk"> <table width="100%" border="0" cellpadding="0" cellspacing="0" ID="Table1"> <tr id="spacer"> <td class="leftnav" align="right" valign="top" nowrap width="120px"> <h5>Find Honey from:</h5> <p><a href="HaL.php">Highlands and Islands</a></p> <p><a href="NES.php">North Eastern Scotland</a></p> <p><a href="ES.php">Eastern Scotland</a></p> <p><a href="SWS.php">South Western Scotland</a> <h5>List your produce:</h5> <p><a href="keeperlogin.php">Keepers Page</a></p> </td> <td> <?php $sql = "SELECT * FROM keepers WHERE area = 'HaI'"; $result = mysqli_query($link, $sql); echo "<table width=100% border='1'> <tr> <th><p class='success'>Shop Name</p></th> <th><p class='success'>Shop Email</p></th> <th><p class='success'>Town</p></th> <th><p class='success'>Phone Number</p></th> <th><p class='success'>Mobile Number</p></th> </tr>"; while($row = mysqli_fetch_assoc($result)) { $id = $row['ID']; echo "$id"; echo "<tr>"; echo "<td> <a href='viewdetails.php?id=$id'>" . $row['shop_name'] . "</a> </td>"; echo "<td> <a href='viewdetails.php?id=$id'>" . $row['shop_email'] . "</a> </td>"; echo "<td> <a href='viewdetails.php?id=$id'>" . $row['town'] . "</a> </td>"; echo "<td> <a href='viewdetails.php?id=$id'>" . $row['phone_number'] . "</a> </td>"; echo "<td> <a href='viewdetails.php?id=$id'>" . $row['mobile_number'] . "</a> </td>"; echo "</tr>"; echo "</table>"; } ?> </td> </tr> </table> </div> <div id="footer"> © 2008 beekeeper.com | <A href="privacy.html">Privacy Policy</A> | <A href="terms.html">Terms of Use</A> </div> </body>
-
Codeigniter REST API file upload Issue
Thank you in advance for helping me,
I am trying to upload a file in CodeIgniter REST API. When I am trying it with POSTMAN it is not showing in any of the following
$_FILES,
file_get_contents('php://input')
I have also tried with the help of CodeIgniter Library "Upload" but no result.
Can someone help me out? what exactly I am doing wrong here?
When I am printing $_POST then showing following result
Array ( [------WebKitFormBoundarye2blQXoYtrJbszuc Content-Disposition:_form-data;_name] => "image"; filename="welingkar-second-year-payment.png" Content-Type: image/png
�PNG
.... )
please help...
-
Open check.php by Opening Folder Directory using htaccess
Sir, I have a Folder named F_Check that contains check.php and some other PHP files.
Sir, I want the User to show or redirect to check.php If user open F_Check directory. Means where index.php should open, check.php should be open. But After opening other PHP files, it should not redirect to check.php File.
I search for it but did not find any Specific code, But I well know that it can be done using htaccess.
Thanks.
-
MySql UPDATE autoincrement +1 error adding TWO
I have a form that updates a class registration system after someone makes a payment.
I need the column to just update by 1 but it's actually updating it by 2.
For example, if the column is currently at "4", after the query runs it will be updated to "6", how can I just get it to update to "5" like I need it to?
Here is my code.
$db = new mysqli('HOST', 'USERNAME', 'PASSWORD', 'NAME'); if($db->connect_errno > 0) { die('Unable to connect to database [' . $db->connect_error . ']'); } $sql = "UPDATE Registration SET Registered = Registered + 1 WHERE CourseNumber = '$id'"; if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']'); } $db->query($sql); $db->close();
-
How do I set a conditional for a checkbox in an access report
so basically I am making a student database that contains student grades, I have a query that gives me a list of what classes a specific student has taken that are part of their major. This is what the query returns: Query result
So what I want to do is create a report that has a section like this where it lists all possible classes they can taken per that major: Report and I want to have a checkbox next to each class and have the box be checked off if they have taken the class, if they have not I want the box to be empty, so I don't necessarily need anything on the report like grades etc. I just want it checked off if they have taken that specific class . How can I go about this, lost on this part.
-
Recursive self join over file data
I know there are many questions about recursive self joins, but they're mostly in a hierarchical data structure as follows:
ID | Value | Parent id -----------------------------
But I was wondering if there was a way to do this in a specific case that I have where I don't necessarily have a parent id. My data will look like this when I initially load the file.
ID | Line | ------------------------- 1 | 3,Formula,1,2,3,4,... 2 | *,record,abc,efg,hij,... 3 | ,,1,x,y,z,... 4 | ,,2,q,r,s,... 5 | 3,Formula,5,6,7,8,... 6 | *,record,lmn,opq,rst,... 7 | ,,1,t,u,v,... 8 | ,,2,l,m,n,...
Essentially, its a CSV file where each row in the table is a line in the file. Lines 1 and 5 identify an object header and lines 3, 4, 7, and 8 identify the rows belonging to the object. The object header lines can have only 40 attributes which is why the object is broken up across multiple sections in the CSV file.
What I'd like to do is take the table, separate out the record # column, and join it with itself multiple times so it achieves something like this:
ID | Line | ------------------------- 1 | 3,Formula,1,2,3,4,5,6,7,8,... 2 | *,record,abc,efg,hij,lmn,opq,rst 3 | ,,1,x,y,z,t,u,v,... 4 | ,,2,q,r,s,l,m,n,...
I know its probably possible, I'm just not sure where to start. My initial idea was to create a view that separates out the first and second columns in a view, and use the view as a way of joining in a repeated fashion on those two columns. However, I have some problems:
- I don't know how many sections will occur in the file for the same object
- The file can contain other objects as well so joining on the first two columns would be problematic if you have something like
ID | Line | ------------------------- 1 | 3,Formula,1,2,3,4,... 2 | *,record,abc,efg,hij,... 3 | ,,1,x,y,z,... 4 | ,,2,q,r,s,... 5 | 3,Formula,5,6,7,8,... 6 | *,record,lmn,opq,rst,... 7 | ,,1,t,u,v,... 8 | ,,2,l,m,n,... 9 | ,4,Data,1,2,3,4,... 10 | *,record,lmn,opq,rst,... 11 | ,,1,t,u,v,...
In the above case, my plan could join rows from the Data object in row 9 with the first rows of the Formula object by matching the record value of 1.
-
heeatmap of a metal sphere cooling
I am currently doing a project where i am heating a metal sphere (From T0 to T1). I have solved for the temperature u(r,t) on the sphere as a function of the radius and time and it's given by a Fourier series. . How can i make a heatmap on the surface of a sphere.
So far i have:
syms t R=1; r=1; N=3; T0=-100; T1=100; a=1.3e-7; %t=linspace(0,3,N); % evaluate u(r,t) at each time step, and record [x,y,z]= sphere(100); %u = [zeros(N,1) ; %u = T0; u=T0 for k = 2:N La_k= (k.*(pi)./R).^2; r_k=(r.^(-1)).*sin(sqrt(La_k).*r); u= u+ ((T1-T0)^2) .* ((-1).^(k+1)) .* (R./(k.*(pi))) .* exp(-a.*La_k.*t) .*r_k; end t=linspace(5,20,10); f=@(t) u(N); g=feval(f,t) % create dummy plot hs = surf(x,y,z,g); colorbar colormap(jet)
-
How to make a Docker environment variable value to get a random id
I am looking to pass an environment variable which should get a
random id
.Something like below.
ENV SERVICE_TAG= $uuid
In short, every time I run the container, I should get a random id for this environment variable inside the container.
Can anyone please suggest the way forward?
Thanks and regards,
Prasanth.
-
What does that mean "$vm1 | Set-AzureSubnet"?
You can see my question but I don't ask about the variable and the command but about the "|". I know that I can use it to execute first the command on the left of "|" and then execute the command on the right. But I don't have any idea what does it mean with the variable(which is defined already) on the left and the command of the right.
$vm1 | Set-AzureSubnet -SubnetNames "defualt"
Why do I ask? If I understood it I can fix an error, hopefully.
Thank in advance!
-
How to upgrade the version of a website from php4 to php7
I have a project which has been developed in php 4 now it has to be upgraded to php 7.
The database is connected via odbc connection. When i try to connect to the database and run the index file nothing seems to pop up.
What i have done is i have converted my database into mysql and tried to connect to the database and it is connecting .
How do i change the complete odbc to mysql?
Please find below the odbc dataconnection file and let me know how to i connect it with mysqli.
<?php //##################### ODBC CONNECT ####################### class DBConnectionManager{ var $DB; function DBConnectionManager(){ $this->DB=$this->DBConnect(); } function DBConnect() { //connection to database // $dbconnect = odbc_connect(DB_SOURCE_NAME,DB_USERNAME,DB_PASSWORD) $dbconnect = new mysqli("localhost",DB_USERNAME,DB_PASSWORD); or die("Unable to Connect to SQL SERVER on ".DB_SOURCE_NAME); return $dbconnect; } function DBexecute($query='') { $result = odbc_exec($this->DB,$query); return $result; } function DBRows($query='') { $result=$this->DBexecute($query); $num_row = 0; while ($row = odbc_fetch_array($result)) { $num_row++; } odbc_free_result($result); return $num_row; } function mysqlFetchArray($arry){ return odbc_fetch_array($arry); } function closeConnection(){ if(isset($this->DB)){ odbc_close($this->DB); unset($this->DB); } } } ?>
What are the other changes i have to make?
Thanks in advance, Renu
-
Error in updating database table and fetching appropriate row using mysqli_fetch
I am trying to send login information to this php script and update certain fields in the database if the username and password exists. But I'm getting an error with mysqli_fetch_array. There are a lot of similar questions here already and I know that the problem is with "$result"(when I print out the value of result it is 1), probably because of the query failure ! But when I execute just the query in mysql it updates the fields without any problem so I'm really clueless. Would really appreciate any help ! Thank you.
This is the php code :
<?php if(isset($_POST) == true && empty($_POST) == false){ $latitude = $_POST['Latitude']; $longitude = $_POST['Longitude']; $timestamp = $_POST['Timestamp']; $Password=$_POST['Password']; $name=$_POST['userName']; $dbname = "android_db"; $servername = "localhost"; $username = "root"; $password = "1234"; //connect to the database $conn = mysqli_connect($servername, $username, $password, $dbname); if(!$conn) { die("Connection Failed" . mysqli_error($conn)); } $sql = "Update LocationTable SET Latitude='$latitude', Longitude='$longitude' WHERE name='$name' AND Password='$Password';"; $result = mysqli_query($conn, $sql); echo"$result"; $response = array(); while($row = mysqli_fetch_array($result)){ $response = array("id"=>$row[0],"name"=>$row[1],"password"=>$row[2],"email"=>$row[3]); } echo json_encode(array("user_data"=>$response)); } ?>
This is the output:
1 <br /> <b>Warning</b>: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in <b>/opt/lampp/htdocs/friendFinder/login.php</b> on line <b>28</b> <br /> {"user_data":[]}
These are the fields in the database table
-
search and replace � in mysql database
I need to search and replace multiple instances of � in text.
Examples: let� s (let's), let�s (let's), we� re (we're), text�s (text's)
I'd like to create a (SQL query) phpMyAdmin
UPDATE categories SET Info = REPLACE (Info, 'we%re','we\'re');