CloudBreaker Posted August 17, 2015 Share Posted August 17, 2015 I'm trying to pass the ID variable on to the next page with no luck. Line 74 is my attempt. thanks, CB <?php include_once 'dbconfig.php'; ?> <?php session_start(); if(!$_SESSION['user_loginName']){ header("location: index.php"); } else { $project_id=$_SESSION['project_id']; if(isset($_GET['id']) && is_numeric($_GET['id'])){ $no = $_GET['id']; //grab discipline $name = $_SESSION['firstName']; $sel = "SELECT * FROM hsa_users WHERE user_firstName='$name'"; $run = mysqli_query($conn, $sel); $row=mysqli_fetch_array($run);{ $discipline = $row['user_discipline']; //End of grab discipline } //grab RFI No. $s = "SELECT * FROM rfis WHERE no='$no'"; //note...it doesn't have to be $sql everytime. $run = mysqli_query($conn, $s); $row=mysqli_fetch_array($run);{ $rfiNo = $row['name']; } //end of grab RFI No. } ?> <?php if(isset($_POST['btn-upload'])) { $file = rand(1000,100000)."-".$_FILES['file']['name']; $file_loc = $_FILES['file']['tmp_name']; $file_size = $_FILES['file']['size']; $file_type = $_FILES['file']['type']; $folder ="rfi_files/"; // new file size in KB $new_size = $file_size/1024; // new file size in KB // make file name in lower case $new_file_name = strtolower($file); // make file name in lower case $final_file=str_replace(' ','-',$new_file_name); if(move_uploaded_file($file_loc,$folder.$final_file)) { $sql="INSERT INTO rfi_files(no,file,type,size) VALUES('$no','$final_file','$file_type','$new_size')"; mysqli_query($conn,$sql); ?> <script> alert('successfully uploaded'); window.location.href='rfi-files.php?id=<?php echo $edit_id;?>success'; </script> <?php } else { ?> <script> alert('error while uploading file'); window.location.href='rfi-upload.php?fail'; </script> <?php } } ?> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/297822-using-a-get-variable-in-java-script/ Share on other sites More sharing options...
QuickOldCar Posted August 17, 2015 Share Posted August 17, 2015 There isn't any $edit-id variable, I see a possible $no or $project_id can use. You can do this with header() instead, even with a message and delay if wanted to. Additionally use exit; after header() so the rest of the script does not continue. Quote Link to comment https://forums.phpfreaks.com/topic/297822-using-a-get-variable-in-java-script/#findComment-1519048 Share on other sites More sharing options...
CloudBreaker Posted August 17, 2015 Author Share Posted August 17, 2015 There isn't any $edit-id variable, I see a possible $no or $project_id can use. You can do this with header() instead, even with a message and delay if wanted to. Additionally use exit; after header() so the rest of the script does not continue. $no is the value I would like to pass to the next page which is rfi-files.php thnx Quote Link to comment https://forums.phpfreaks.com/topic/297822-using-a-get-variable-in-java-script/#findComment-1519051 Share on other sites More sharing options...
Solution QuickOldCar Posted August 17, 2015 Solution Share Posted August 17, 2015 (edited) window.location.href='rfi-files.php?id=<?php echo $no;?>'; Edited August 17, 2015 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/297822-using-a-get-variable-in-java-script/#findComment-1519052 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.